Re: multi-dimensional array whole slicing

2017-04-22 Thread kinke via Digitalmars-d-learn
On Saturday, 22 April 2017 at 20:51:46 UTC, XavierAP wrote: I can do: int[3] arr = void; arr[] = 1; But apparently I can't do: int[3][4] arr = void; arr[][] = 1; What is the best way? What am I missing? int[3][4] arr = void; (cast(int[]) arr)[] = 1; assert(arr[3][2] == 1);

Binding a udp socket to a port(on the local machine)

2017-04-22 Thread Chainingsolid via Digitalmars-d-learn
I couldn't figure out how to make a udp socket bound to a port of my choosing on the local machine, to use for listening for incoming connections.

Re: typeof(this) return wrong type

2017-04-22 Thread Ali Çehreli via Digitalmars-d-learn
On 04/22/2017 04:33 AM, Andrey wrote: Hello, I trying to add custom attribute OnClickListener, the problem is that typeof always return BaseView type instead of MyView. There is also typeid() and .classinfo, which may be helpful: writeln(this.classinfo.name); Ali

multi-dimensional array whole slicing

2017-04-22 Thread XavierAP via Digitalmars-d-learn
I can do: int[3] arr = void; arr[] = 1; But apparently I can't do: int[3][4] arr = void; arr[][] = 1; What is the best way? What am I missing?

Re: GC: Understanding potential sources of false pointers

2017-04-22 Thread Kagamin via Digitalmars-d-learn
On Thursday, 20 April 2017 at 20:26:06 UTC, Nick Sabalausky (Abscissa) wrote: (even if it's from a C lib) Same for D: .rdata is fine, but afaik you have only strings there, the rest - .data, .bss, .tls will suffer the same issue.

Re: typeof(this) return wrong type

2017-04-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 22 April 2017 at 12:23:32 UTC, Basile B. wrote: use a "template this" parameter: I think the nicest way to do it is to use the template this parameter in the constructors, since that's the one function that you can guarantee is always called on the most derived type. Of

Re: typeof(this) return wrong type

2017-04-22 Thread Andrey via Digitalmars-d-learn
On Saturday, 22 April 2017 at 12:43:41 UTC, Andrey wrote: On Saturday, 22 April 2017 at 12:23:32 UTC, Basile B. wrote: On Saturday, 22 April 2017 at 11:45:54 UTC, Andrey wrote: use a "template this" parameter: void onCreate(this T)() { writeln(getSymbolsByUDA!(T,

Re: typeof(this) return wrong type

2017-04-22 Thread Andrey via Digitalmars-d-learn
On Saturday, 22 April 2017 at 12:23:32 UTC, Basile B. wrote: On Saturday, 22 April 2017 at 11:45:54 UTC, Andrey wrote: use a "template this" parameter: void onCreate(this T)() { writeln(getSymbolsByUDA!(T, OnClickListener).stringof); } if possible. The problem is not solved if onCreate is

Re: typeof(this) return wrong type

2017-04-22 Thread Basile B. via Digitalmars-d-learn
On Saturday, 22 April 2017 at 11:45:54 UTC, Andrey wrote: On Saturday, 22 April 2017 at 11:36:09 UTC, Stefan Koch wrote: On Saturday, 22 April 2017 at 11:33:22 UTC, Andrey wrote: Hello, I trying to add custom attribute OnClickListener, the problem is that typeof always return BaseView type

Re: Compile time foreach with switch

2017-04-22 Thread Nick Treleaven via Digitalmars-d-learn
On Friday, 21 April 2017 at 19:17:32 UTC, Adam D. Ruppe wrote: Then realize that it does exactly the same thing when it is inside a switch... it always breaks the innermost thing, which happens to be this loop. (note that cases are not `breaked`, the switch is.) By coincidence I ran into

Re: typeof(this) return wrong type

2017-04-22 Thread Andrey via Digitalmars-d-learn
On Saturday, 22 April 2017 at 11:36:09 UTC, Stefan Koch wrote: On Saturday, 22 April 2017 at 11:33:22 UTC, Andrey wrote: Hello, I trying to add custom attribute OnClickListener, the problem is that typeof always return BaseView type instead of MyView. struct OnClickListener { string id; }

Re: typeof(this) return wrong type

2017-04-22 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 22 April 2017 at 11:33:22 UTC, Andrey wrote: Hello, I trying to add custom attribute OnClickListener, the problem is that typeof always return BaseView type instead of MyView. struct OnClickListener { string id; } class BaseView { void onCreate() {

typeof(this) return wrong type

2017-04-22 Thread Andrey via Digitalmars-d-learn
Hello, I trying to add custom attribute OnClickListener, the problem is that typeof always return BaseView type instead of MyView. struct OnClickListener { string id; } class BaseView { void onCreate() { writeln(getSymbolsByUDA!(typeof(this), OnClickListener).stringof); }