www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - static foreach is now in github master

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.com> writes:
For those who want to play with our new static foreach feature and are 
willing to take the steps to building their own dmd, the feature is now 
merged in master: https://github.com/dlang/dmd/pull/6760

Happy hacking!

Andrei
Jul 17 2017
next sibling parent John Colvin <john.loughran.colvin gmail.com> writes:
On Monday, 17 July 2017 at 18:14:35 UTC, Andrei Alexandrescu 
wrote:
 For those who want to play with our new static foreach feature 
 and are willing to take the steps to building their own dmd, 
 the feature is now merged in master: 
 https://github.com/dlang/dmd/pull/6760

 Happy hacking!

 Andrei
or for those using homebrew: `brew install dmd --HEAD`
Jul 17 2017
prev sibling next sibling parent reply Martin Nowak <code dawg.eu> writes:
On Monday, 17 July 2017 at 18:14:35 UTC, Andrei Alexandrescu 
wrote:
 For those who want to play with our new static foreach feature 
 and are willing to take the steps to building their own dmd,
Or just wait for the next nightly until tomorrow around 5AM UTC. curl -fsS https://dlang.org/install.sh | bash -s dmd-nightly
 the feature is now merged in master: 
 https://github.com/dlang/dmd/pull/6760
Great news.
Jul 17 2017
parent reply Seb <seb wilzba.ch> writes:
On Monday, 17 July 2017 at 21:27:40 UTC, Martin Nowak wrote:
 On Monday, 17 July 2017 at 18:14:35 UTC, Andrei Alexandrescu 
 wrote:
 For those who want to play with our new static foreach feature 
 and are willing to take the steps to building their own dmd,
Or just wait for the next nightly until tomorrow around 5AM UTC. curl -fsS https://dlang.org/install.sh | bash -s dmd-nightly
 the feature is now merged in master: 
 https://github.com/dlang/dmd/pull/6760
Great news.
And thanks to dmd-nightly, also on run.dlang.io: https://run.dlang.io/?compiler=dmd-nightly&source=void%20main(string%5B%5D%20args)%0A%7B%0A%20%20%20%20static%20foreach%20(i;%20%5B0,1,2,3%5D)%0A%09%7B%0A%20%20%20%20%09pragma(msg,%20i);%0A%09%7D%0A%7D
Jul 18 2017
next sibling parent reply Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Tuesday, 18 July 2017 at 10:02:10 UTC, Seb wrote:
 And thanks to dmd-nightly, also on run.dlang.io:

 https://run.dlang.io/?compiler=dmd-nightly&source=void%20main(string%5B%5D%20args)%0A%7B%0A%20%20%20%20static%20foreach%20(i;%20%5B0,1,2,3%5D)%0A%09%7B%0A%20%20%20%20%09pragma(msg,%20i);%0A%09%7D%0A%7D
This link doesn't work, looks like it cuts off at the first ; ...
Jul 18 2017
parent reply Seb <seb wilzba.ch> writes:
On Tuesday, 18 July 2017 at 10:06:33 UTC, Vladimir Panteleev 
wrote:
 On Tuesday, 18 July 2017 at 10:02:10 UTC, Seb wrote:
 And thanks to dmd-nightly, also on run.dlang.io:

 https://run.dlang.io/?compiler=dmd-nightly&source=void%20main(string%5B%5D%20args)%0A%7B%0A%20%20%20%20static%20foreach%20(i;%20%5B0,1,2,3%5D)%0A%09%7B%0A%20%20%20%20%09pragma(msg,%20i);%0A%09%7D%0A%7D
This link doesn't work, looks like it cuts off at the first ; ...
Oh - seems like that was due to a different behavior between FF and Chrome :/ (Chrome unescapes the semi-colon by default). This has been fixed now, so the link above or this shortlink should work: https://is.gd/1TCQOh
Jul 18 2017
parent reply Jack Stouffer <jack jackstouffer.com> writes:
On Tuesday, 18 July 2017 at 15:46:04 UTC, Seb wrote:
 https://is.gd/1TCQOh
Hmmm, that code is printing
0
1
2
3
0
1
2
3
for me. Shouldn't it just be printing once?
Jul 20 2017
next sibling parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 7/20/17 3:53 PM, Jack Stouffer wrote:
 On Tuesday, 18 July 2017 at 15:46:04 UTC, Seb wrote:
 https://is.gd/1TCQOh
Hmmm, that code is printing
 0
 1
 2
 3
 0
 1
 2
 3
for me. Shouldn't it just be printing once?
I think it's because it's using rdmd, and that runs dmd once to generate dependencies, and one more time to compile. It's not specific to static foreach or the new compiler: https://is.gd/g6WPyv -Steve
Jul 20 2017
prev sibling parent reply Seb <seb wilzba.ch> writes:
On Thursday, 20 July 2017 at 19:53:46 UTC, Jack Stouffer wrote:
 On Tuesday, 18 July 2017 at 15:46:04 UTC, Seb wrote:
 https://is.gd/1TCQOh
Hmmm, that code is printing
0
1
2
3
0
1
2
3
for me. Shouldn't it just be printing once?
I bet you are using `rdmd`? It runs dmd twice on your main file ;-) See also: https://issues.dlang.org/process_bug.cgi https://github.com/dlang/tools/pull/191 https://github.com/dlang/tools/pull/194 (sadly this was reverted)
Jul 20 2017
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 7/20/17 4:08 PM, Seb wrote:
 On Thursday, 20 July 2017 at 19:53:46 UTC, Jack Stouffer wrote:
 On Tuesday, 18 July 2017 at 15:46:04 UTC, Seb wrote:
 https://is.gd/1TCQOh
Hmmm, that code is printing
 0
 1
 2
 3
 0
 1
 2
 3
for me. Shouldn't it just be printing once?
I bet you are using `rdmd`? It runs dmd twice on your main file ;-) See also: https://issues.dlang.org/process_bug.cgi https://github.com/dlang/tools/pull/191 https://github.com/dlang/tools/pull/194 (sadly this was reverted)
I'm just clicking on the run button on the web page you linked to. How do I not run rdmd there? -Steve
Jul 20 2017
parent reply Seb <seb wilzba.ch> writes:
On Thursday, 20 July 2017 at 20:33:47 UTC, Steven Schveighoffer 
wrote:
 On 7/20/17 4:08 PM, Seb wrote:
 On Thursday, 20 July 2017 at 19:53:46 UTC, Jack Stouffer wrote:
 On Tuesday, 18 July 2017 at 15:46:04 UTC, Seb wrote:
 https://is.gd/1TCQOh
Hmmm, that code is printing
 0
 1
 2
 3
 0
 1
 2
 3
for me. Shouldn't it just be printing once?
I bet you are using `rdmd`? It runs dmd twice on your main file ;-) See also: https://issues.dlang.org/process_bug.cgi https://github.com/dlang/tools/pull/191 https://github.com/dlang/tools/pull/194 (sadly this was reverted)
I'm just clicking on the run button on the web page you linked to. How do I not run rdmd there? -Steve
Oh because I thought run.dlang.io wasn't using `rdmd`. However, there was a minor glitch today when I added support for flags and stdin to the docker images [2]. The good news is that it has been fixed [2] & everything should behave as usual. Sorry for the inconvenience and continued happy hacking! [1] https://github.com/dlang-tour/core-exec/pull/2 [2] https://github.com/dlang-tour/core-exec/pull/4
Jul 20 2017
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On Thursday, 20 July 2017 at 21:02:20 UTC, Seb wrote:
 Oh because I thought run.dlang.io wasn't using `rdmd`.
 However, there was a minor glitch today when I added support 
 for flags and stdin to the docker images [2]. The good news is 
 that it has been fixed [2] & everything should behave as usual.
 Sorry for the inconvenience and continued happy hacking!

 [1] https://github.com/dlang-tour/core-exec/pull/2
 [2] https://github.com/dlang-tour/core-exec/pull/4
Now: Compilation or running program took longer than 25 seconds. Aborted! -Steve
Jul 22 2017
parent reply Seb <seb wilzba.ch> writes:
On Saturday, 22 July 2017 at 21:13:47 UTC, Steven Schveighoffer 
wrote:
 On Thursday, 20 July 2017 at 21:02:20 UTC, Seb wrote:
 Oh because I thought run.dlang.io wasn't using `rdmd`.
 However, there was a minor glitch today when I added support 
 for flags and stdin to the docker images [2]. The good news is 
 that it has been fixed [2] & everything should behave as usual.
 Sorry for the inconvenience and continued happy hacking!

 [1] https://github.com/dlang-tour/core-exec/pull/2
 [2] https://github.com/dlang-tour/core-exec/pull/4
Now: Compilation or running program took longer than 25 seconds. Aborted! -Steve
Hmm, seems to be a temporary error. It works fine for me. Are you still experiencing this?
Jul 22 2017
parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 7/22/17 5:26 PM, Seb wrote:
 On Saturday, 22 July 2017 at 21:13:47 UTC, Steven Schveighoffer wrote:
 On Thursday, 20 July 2017 at 21:02:20 UTC, Seb wrote:
 Oh because I thought run.dlang.io wasn't using `rdmd`.
 However, there was a minor glitch today when I added support for 
 flags and stdin to the docker images [2]. The good news is that it 
 has been fixed [2] & everything should behave as usual.
 Sorry for the inconvenience and continued happy hacking!

 [1] https://github.com/dlang-tour/core-exec/pull/2
 [2] https://github.com/dlang-tour/core-exec/pull/4
Now: Compilation or running program took longer than 25 seconds. Aborted!
Hmm, seems to be a temporary error. It works fine for me. Are you still experiencing this?
Just tried again, now working (and displaying only one list of numbers) thanks. -Steve
Jul 22 2017
prev sibling parent Martin Tschierschke <mt smartdolphin.de> writes:
On Tuesday, 18 July 2017 at 10:02:10 UTC, Seb wrote:
 On Monday, 17 July 2017 at 21:27:40 UTC, Martin Nowak wrote:
 On Monday, 17 July 2017 at 18:14:35 UTC, Andrei Alexandrescu 
 wrote:
 For those who want to play with our new static foreach 
 feature and are willing to take the steps to building their 
 own dmd,
Or just wait for the next nightly until tomorrow around 5AM UTC. curl -fsS https://dlang.org/install.sh | bash -s dmd-nightly
 the feature is now merged in master: 
 https://github.com/dlang/dmd/pull/6760
Great news.
And thanks to dmd-nightly, also on run.dlang.io: https://run.dlang.io/?compiler=dmd-nightly&source=void%20main(string%5B%5D%20args)%0A%7B%0A%20%20%20%20static%20foreach%20(i;%20%5B0,1,2,3%5D)%0A%09%7B%0A%20%20%20%20%09pragma(msg,%20i);%0A%09%7D%0A%7D
Cool! Thank you!
Jul 18 2017
prev sibling next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2017-07-17 20:14, Andrei Alexandrescu wrote:
 For those who want to play with our new static foreach feature and are 
 willing to take the steps to building their own dmd, the feature is now 
 merged in master: https://github.com/dlang/dmd/pull/6760
 
 Happy hacking!
That was quick, and awesome :) Great work to Timon and everyone else involved. -- /Jacob Carlborg
Jul 17 2017
parent Daniel N <no public.email> writes:
On Tuesday, 18 July 2017 at 06:48:29 UTC, Jacob Carlborg wrote:
 On 2017-07-17 20:14, Andrei Alexandrescu wrote:
 For those who want to play with our new static foreach feature 
 and are willing to take the steps to building their own dmd, 
 the feature is now merged in master: 
 https://github.com/dlang/dmd/pull/6760
 
 Happy hacking!
That was quick, and awesome :) Great work to Timon and everyone else involved.
wow! Now, just how am I supposed to be able to work today (using C) and not play with this pure awesomeness?!
Jul 17 2017
prev sibling next sibling parent Basile B. <b2.temp gmx.com> writes:
On Monday, 17 July 2017 at 18:14:35 UTC, Andrei Alexandrescu 
wrote:
 For those who want to play with our new static foreach feature 
 and are willing to take the steps to building their own dmd, 
 the feature is now merged in master: 
 https://github.com/dlang/dmd/pull/6760

 Happy hacking!

 Andrei
I cant find the matching dlang.org pull request. The one that specifies the changes applied to the grammar.
Jul 24 2017
prev sibling parent Laeeth Isharc <laeeth nospam.kaleidic.io> writes:
On Monday, 17 July 2017 at 18:14:35 UTC, Andrei Alexandrescu 
wrote:
 For those who want to play with our new static foreach feature 
 and are willing to take the steps to building their own dmd, 
 the feature is now merged in master: 
 https://github.com/dlang/dmd/pull/6760

 Happy hacking!

 Andrei
Maybe good subject for an AMA (though not many upvoted so far). It's pretty cool that it was added on an afternoon during the hackathon. https://www.reddit.com/r/programming/comments/6pn257/static_foreach_added_to_d_compiler_nightly/ Could someone post to Hacker News - I don't have enough rep there for stories to propagate. Can always post another story later on explaining the practical benefits of static foreach (good topic for a D blog post) - marketing is about repetition.
Jul 26 2017