Re: Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-26 Thread Era Scarecrow via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 16:30:06 UTC, data pulverizer wrote: On Wednesday, 22 December 2021 at 16:10:42 UTC, Adam D Ruppe wrote: So OUTSIDE a function, static foreach() {{ }} is illegal because a plain {} is illegal outside a function. But INSIDE a function, static foreach() {{ }} is

Re: Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 16:10:42 UTC, Adam D Ruppe wrote: So OUTSIDE a function, static foreach() {{ }} is illegal because a plain {} is illegal outside a function. But INSIDE a function, static foreach() {{ }} is legal, but it isn't magic about static foreach - it is just a body wit

Re: Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 16:01:49 UTC, rikki cattermole wrote: Seems to be working just fine as of 2.098. ```d import std; void main() { static foreach(Foo; ["Abc", "def"]) {{ string str = Foo; writeln("Hello D ", str, __VERSION__); }} } ``` ``` Hello D Abc2098

Re: Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread ag0aep6g via Digitalmars-d-learn
On 22.12.21 17:01, rikki cattermole wrote: Anyway, AliasAssign has nothing to do with this. This "trick" creates a closure aka ``() { ... }``. Thats all its doing. From the AST dump: ``` import object; import std; void main() { {     string str = "Abc";     writeln("Hello D ",

Re: Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 15:57:29 UTC, data pulverizer wrote: I noticed that the double bracket `{{` for scoping `static foreach` is no longer part of D and it looks like it has been replaced with https://dlang.org/changelog/2.098.0.html#AliasAssign None of these things have

Re: Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread rikki cattermole via Digitalmars-d-learn
Seems to be working just fine as of 2.098. ```d import std; void main() { static foreach(Foo; ["Abc", "def"]) {{ string str = Foo; writeln("Hello D ", str, __VERSION__); }} } ``` ``` Hello D Abc2098 Hello D def2098 ``` Anyway, AliasAssign has nothing to do with this. Thi

Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread data pulverizer via Digitalmars-d-learn
Hi All, I noticed that the double bracket `{{` for scoping `static foreach` is no longer part of D and it looks like it has been replaced with https://dlang.org/changelog/2.098.0.html#AliasAssign. Could someone confirm this with a link to the DIP and any other tools that we should be using