Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
April 25, 2019 DMD metaprogramming enhancement | ||||
---|---|---|---|---|
| ||||
Hello everyone, I am happy to announce that in the next DMD release you will be able to more freely enjoy your metaprograming experience now that a long-standing limitation has been lifted. You can now instantiate local and member templates with local symbols. Example: --- struct S { private int _m; void exec(alias fun)() { fun(_m); } } unittest { int localVar; void set(int i) { localVar = i; } auto obj = S(10); obj.exec!set(); // no error or warning assert(localVar == 10); } --- I hope you enjoy! |
April 25, 2019 Re: DMD metaprogramming enhancement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suleyman | On Thu, Apr 25, 2019 at 11:41:32PM +0000, Suleyman via Digitalmars-d-announce wrote: > Hello everyone, > > I am happy to announce that in the next DMD release you will be able to more freely enjoy your metaprograming experience now that a long-standing limitation has been lifted. > > You can now instantiate local and member templates with local symbols. [...] That's very nice. Which PR was it that implemented this? T -- Век живи - век учись. А дураком помрёшь. |
April 26, 2019 Re: DMD metaprogramming enhancement | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On Friday, 26 April 2019 at 00:12:06 UTC, H. S. Teoh wrote: > That's very nice. Which PR was it that implemented this? > > > T This one https://github.com/dlang/dmd/pull/9282. |
April 26, 2019 Re: DMD metaprogramming enhancement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suleyman | On Thursday, 25 April 2019 at 23:41:32 UTC, Suleyman wrote:
> Hello everyone,
>
> I am happy to announce that in the next DMD release you will be able to more freely enjoy your metaprograming experience now that a long-standing limitation has been lifted.
>
> You can now instantiate local and member templates with local symbols.
>
> Example:
> ---
> struct S
> {
> private int _m;
> void exec(alias fun)()
> {
> fun(_m);
> }
> }
>
> unittest
> {
> int localVar;
>
> void set(int i)
> {
> localVar = i;
> }
>
> auto obj = S(10);
> obj.exec!set(); // no error or warning
>
> assert(localVar == 10);
> }
> ---
>
> I hope you enjoy!
Noice! Finally indeed. thank you! :D
|
April 26, 2019 Re: DMD metaprogramming enhancement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suleyman | On Thursday, 25 April 2019 at 23:41:32 UTC, Suleyman wrote:
> Hello everyone,
>
> I am happy to announce that in the next DMD release you will be able to more freely enjoy your metaprograming experience now that a long-standing limitation has been lifted.
>
> You can now instantiate local and member templates with local symbols.
>
> Example:
> ---
> struct S
> {
> private int _m;
> void exec(alias fun)()
> {
> fun(_m);
> }
> }
>
> unittest
> {
> int localVar;
>
> void set(int i)
> {
> localVar = i;
> }
>
> auto obj = S(10);
> obj.exec!set(); // no error or warning
>
> assert(localVar == 10);
> }
> ---
>
> I hope you enjoy!
You have no idea how happy I am to hear this has been fixed! So many of my designs have been hamstrung by 5710, and it's been around since the dawn of time.
--
Simen
|
April 26, 2019 Re: DMD metaprogramming enhancement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjærås | On Friday, 26 April 2019 at 06:29:04 UTC, Simen Kjærås wrote: > On Thursday, 25 April 2019 at 23:41:32 UTC, Suleyman wrote: >> Hello everyone, >> >> I am happy to announce that in the next DMD release you will be able to more freely enjoy your metaprograming experience now that a long-standing limitation has been lifted. >> >> You can now instantiate local and member templates with local symbols. >> >> Example: >> --- >> struct S >> { >> private int _m; >> void exec(alias fun)() >> { >> fun(_m); >> } >> } >> >> unittest >> { >> int localVar; >> >> void set(int i) >> { >> localVar = i; >> } >> >> auto obj = S(10); >> obj.exec!set(); // no error or warning >> >> assert(localVar == 10); >> } >> --- >> >> I hope you enjoy! > > You have no idea how happy I am to hear this has been fixed! So many of my designs have been hamstrung by 5710, and it's been around since the dawn of time. BTW, at least two people have promised money outside BountySource to have 5710 fixed: https://forum.dlang.org/post/gjzrklkxfmgjjdforbrs@forum.dlang.org -- Simen |
April 26, 2019 Re: DMD metaprogramming enhancement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suleyman | On Thursday, 25 April 2019 at 23:41:32 UTC, Suleyman wrote:
> Hello everyone,
>
> I am happy to announce that in the next DMD release you will be able to more freely enjoy your metaprograming experience now that a long-standing limitation has been lifted.
>
> You can now instantiate local and member templates with local symbols.
>
> Example:
> ---
> struct S
> {
> private int _m;
> void exec(alias fun)()
> {
> fun(_m);
> }
> }
>
> unittest
> {
> int localVar;
>
> void set(int i)
> {
> localVar = i;
> }
>
> auto obj = S(10);
> obj.exec!set(); // no error or warning
>
> assert(localVar == 10);
> }
> ---
>
> I hope you enjoy!
Thanks a lot. It is really refreshing to know this has been fixed.
|
April 27, 2019 Re: DMD metaprogramming enhancement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjærås | On Friday, 26 April 2019 at 06:34:26 UTC, Simen Kjærås wrote:
> BTW, at least two people have promised money outside BountySource to have 5710 fixed:
> https://forum.dlang.org/post/gjzrklkxfmgjjdforbrs@forum.dlang.org
>
> --
> Simen
And my offer still stands. Suleyman, do you have an email address I can contact you at to arrange payment?
|
April 27, 2019 Re: DMD metaprogramming enhancement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjærås | On Friday, 26 April 2019 at 06:29:04 UTC, Simen Kjærås wrote: > On Thursday, 25 April 2019 at 23:41:32 UTC, Suleyman wrote: >> [...] > > You have no idea how happy I am to hear this has been fixed! So many of my designs have been hamstrung by 5710, and it's been around since the dawn of time. > > -- > Simen Boh, there’s a revert under discussion :( - https://github.com/dlang/dmd/pull/9702 ( not merged yet but 🤷♂️) |
Copyright © 1999-2021 by the D Language Foundation