Re: Any workaround for "closures are not yet supported in CTFE"?

2021-12-07 Thread Andrey Zherikov via Digitalmars-d-learn
On Tuesday, 7 December 2021 at 18:50:04 UTC, Ali Çehreli wrote: I don't know whether the workaround works with your program but that delegate is the equivalent of the following struct (the struct should be faster because there is no dynamic context allocation). Note the type of 'dg' is changed

Re: Mixin template overloads not working

2021-12-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/7/21 1:03 PM, Q. Schroll wrote: On Tuesday, 7 December 2021 at 12:43:40 UTC, Rumbu wrote: Bug or feature? Feature. It even has a name: "overload set". It keeps you from accidentally calling a function you had no idea existed, for example because of a name clash. Not in this case.

Re: Any workaround for "closures are not yet supported in CTFE"?

2021-12-07 Thread Ali Çehreli via Digitalmars-d-learn
On 12/7/21 7:30 AM, Andrey Zherikov wrote: > auto createDelegate(string s) > { > return { s.writeln; }; // Error: closures are not yet > supported in CTFE > } I don't know whether the workaround works with your program but that delegate is the equivalent of the following struct (the

Re: Mixin template overloads not working

2021-12-07 Thread Q. Schroll via Digitalmars-d-learn
On Tuesday, 7 December 2021 at 12:43:40 UTC, Rumbu wrote: Bug or feature? Feature. It even has a name: "overload set". It keeps you from accidentally calling a function you had no idea existed, for example because of a name clash. Is there any workaround? Yes, the error message is very

Any workaround for "closures are not yet supported in CTFE"?

2021-12-07 Thread Andrey Zherikov via Digitalmars-d-learn
I have a struct `A` that stores delegates. The problem is that I'm getting "`Error: closures are not yet supported in CTFE`" if I create an compile-time constant value of type `A`: ```d struct A { void delegate()[] dg; } auto createDelegate(string s) { return { s.writeln; }; //

Re: Mixin template overloads not working

2021-12-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/7/21 7:43 AM, Rumbu wrote: On Friday, 3 December 2021 at 10:57:34 UTC, Stanislav Blinov wrote: On Friday, 3 December 2021 at 10:42:37 UTC, Rumbu wrote: Bug or feature? Is there any workaround? The error message explains what to do :) Error: class `mixinover.AnotherVisitor` use of

Re: Mixin template overloads not working

2021-12-07 Thread Rumbu via Digitalmars-d-learn
On Friday, 3 December 2021 at 10:57:34 UTC, Stanislav Blinov wrote: On Friday, 3 December 2021 at 10:42:37 UTC, Rumbu wrote: Bug or feature? Is there any workaround? The error message explains what to do :) Error: class `mixinover.AnotherVisitor` use of `mixinover.Visitor.visit(S s)` is