digitalmars.D - Advent of D
- Jordi =?UTF-8?B?R3V0acOpcnJleg==?= Hermoso (3/3) Mar 06 2018 I wrote a blog post about working on Advent of Code in D. You can
- David Gileadi (2/6) Mar 06 2018 I really enjoyed this. Thank you!
- Joakim (4/7) Mar 06 2018 What's with the mammoth D blog posts lately? Nice write-up, worth
- Jordi =?UTF-8?B?R3V0acOpcnJleg==?= Hermoso (7/8) Mar 06 2018 Thanks. I tried posting it to HN, but it didn't pick up. If
- Adam D. Ruppe (4/5) Mar 06 2018 This is random but I have been thinking about asking for a
- Mike Parker (5/7) Mar 06 2018 I'll post it. There are good times and bad times to post on
- Mike Parker (3/11) Mar 07 2018 Ah, well. Someone had already submitted it. And completely missed
- Jordi =?UTF-8?B?R3V0acOpcnJleg==?= Hermoso (6/19) Mar 07 2018 Oh?
- Mike Parker (4/8) Mar 07 2018 Sorry, should have pasted the link:
- Jordi =?UTF-8?B?R3V0acOpcnJleg==?= Hermoso (3/14) Mar 07 2018 Ah, I see. Pity. Maybe it'll get rediscovered in a few months and
- Andrei Alexandrescu (7/19) Mar 07 2018 The post does not appear on the /r/programming page, so it has been
- =?UTF-8?Q?Ali_=c3=87ehreli?= (3/5) Mar 08 2018 On the first page right now.
- Patrick Schluter (3/6) Mar 06 2018 Really nice, thank you.
- Steven Schveighoffer (33/37) Mar 06 2018 I'm enjoying this.
- Jordi =?UTF-8?B?R3V0acOpcnJleg==?= Hermoso (11/21) Mar 06 2018 Thanks for the explanation. I forgot about using enum instead. I
- Andrea Fontana (6/13) Mar 07 2018 What about static immutable? I think enums exist only for
- Steven Schveighoffer (8/21) Mar 07 2018 Static immutable works (and makes sense as a static variable) if you can...
- JN (6/9) Mar 06 2018 on Day 8, I think the original "verbose" code is better in the
- Jordi =?UTF-8?B?R3V0acOpcnJleg==?= Hermoso (4/14) Mar 06 2018 Yeah, it's mostly the C&P that I wanted to get rid of. I do wish
- Russel Winder (10/14) Mar 07 2018 Another blog post deserving of formal publication in an ACCU journal.
- Jordi =?UTF-8?B?R3V0acOpcnJleg==?= Hermoso (4/12) Mar 08 2018 Hm, I quickly looked at what that is. Some sort of informal
- Russel Winder (13/27) Mar 09 2018 The journals take a mix of articles written for the journal and blog
I wrote a blog post about working on Advent of Code in D. You can read it here: http://jordi.inversethought.com/blog/advent-of-d/
Mar 06 2018
On 3/6/18 11:09 AM, Jordi Gutiérrez Hermoso wrote:I wrote a blog post about working on Advent of Code in D. You can read it here: http://jordi.inversethought.com/blog/advent-of-d/I really enjoyed this. Thank you!
Mar 06 2018
On Tuesday, 6 March 2018 at 18:09:21 UTC, Jordi Gutiérrez Hermoso wrote:I wrote a blog post about working on Advent of Code in D. You can read it here: http://jordi.inversethought.com/blog/advent-of-d/What's with the mammoth D blog posts lately? Nice write-up, worth sharing on reddit/HN.
Mar 06 2018
On Tuesday, 6 March 2018 at 20:09:58 UTC, Joakim wrote:Nice write-up, worth sharing on reddit/HN.Thanks. I tried posting it to HN, but it didn't pick up. If several of you try posting it too, it might pick up. Posting to Reddit is easier, but I don't have a recognisable account on Reddit to post it from. I did post it to Lobsters, though: https://lobste.rs/s/b4qki7/advent_d
Mar 06 2018
On Tuesday, 6 March 2018 at 21:09:06 UTC, Jordi Gutiérrez Hermoso wrote:I did post it to Lobsters, though:This is random but I have been thinking about asking for a lobsters invite... can you hook me up?
Mar 06 2018
On Tuesday, 6 March 2018 at 21:09:06 UTC, Jordi Gutiérrez Hermoso wrote:Posting to Reddit is easier, but I don't have a recognisable account on Reddit to post it from.I'll post it. There are good times and bad times to post on /r/programming in terms of getting attention. A good time would be in about ~12 hours or so.
Mar 06 2018
On Wednesday, 7 March 2018 at 01:07:54 UTC, Mike Parker wrote:On Tuesday, 6 March 2018 at 21:09:06 UTC, Jordi Gutiérrez Hermoso wrote:Ah, well. Someone had already submitted it. And completely missed the window :-(Posting to Reddit is easier, but I don't have a recognisable account on Reddit to post it from.I'll post it. There are good times and bad times to post on /r/programming in terms of getting attention. A good time would be in about ~12 hours or so.
Mar 07 2018
On Wednesday, 7 March 2018 at 14:02:19 UTC, Mike Parker wrote:On Wednesday, 7 March 2018 at 01:07:54 UTC, Mike Parker wrote:Oh? I only see it here: https://www.reddit.com/r/d_language/comments/82i0s4/advent_of_d/ There don't seem to be duplicate reposts to other subreddits. Where are you seeing it?On Tuesday, 6 March 2018 at 21:09:06 UTC, Jordi Gutiérrez Hermoso wrote:Ah, well. Someone had already submitted it. And completely missed the window :-(Posting to Reddit is easier, but I don't have a recognisable account on Reddit to post it from.I'll post it. There are good times and bad times to post on /r/programming in terms of getting attention. A good time would be in about ~12 hours or so.
Mar 07 2018
On Wednesday, 7 March 2018 at 14:43:24 UTC, Jordi Gutiérrez Hermoso wrote:I only see it here: https://www.reddit.com/r/d_language/comments/82i0s4/advent_of_d/ There don't seem to be duplicate reposts to other subreddits. Where are you seeing it?Sorry, should have pasted the link: https://www.reddit.com/r/programming/comments/82j5m0/advent_of_d_a_good_overview_of_d_programming/
Mar 07 2018
On Wednesday, 7 March 2018 at 14:50:34 UTC, Mike Parker wrote:On Wednesday, 7 March 2018 at 14:43:24 UTC, Jordi Gutiérrez Hermoso wrote:Ah, I see. Pity. Maybe it'll get rediscovered in a few months and people will post it again.I only see it here: https://www.reddit.com/r/d_language/comments/82i0s4/advent_of_d/ There don't seem to be duplicate reposts to other subreddits. Where are you seeing it?Sorry, should have pasted the link: https://www.reddit.com/r/programming/comments/82j5m0/advent_of_d_a_good_overview_of_d_programming/
Mar 07 2018
On 03/07/2018 09:50 AM, Mike Parker wrote:On Wednesday, 7 March 2018 at 14:43:24 UTC, Jordi Gutiérrez Hermoso wrote:The post does not appear on the /r/programming page, so it has been flagged as spam. All: please coordinate social media announcements of your D-related work with Michael Parker for best results. Thanks, AndreiI only see it here: https://www.reddit.com/r/d_language/comments/82i0s4/advent_of_d/ There don't seem to be duplicate reposts to other subreddits. Where are you seeing it?Sorry, should have pasted the link: https://www.reddit.com/r/programming/comments/82j5m0/advent_of_d_a_good_overvi w_of_d_programming/
Mar 07 2018
On 03/07/2018 09:26 AM, Andrei Alexandrescu wrote:The post does not appear on the /r/programming page, so it has been flagged as spam.On the first page right now. Ali
Mar 08 2018
On Tuesday, 6 March 2018 at 18:09:21 UTC, Jordi Gutiérrez Hermoso wrote:I wrote a blog post about working on Advent of Code in D. You can read it here: http://jordi.inversethought.com/blog/advent-of-d/Really nice, thank you.
Mar 06 2018
On 3/6/18 1:09 PM, Jordi Gutiérrez Hermoso wrote:I wrote a blog post about working on Advent of Code in D. You can read it here: http://jordi.inversethought.com/blog/advent-of-d/I'm enjoying this. One thing jumped out at me: static does not mean execute at compile time (exactly), it really means allocate this data in thread-local storage. What triggers the compile-time execution is the fact that static *initializers* need to be decided at compile time. So while it is executing the regex building at compile time in your example, there are other ways to do it, and in this case, I'd prefer using an enum. You can also use ctRegex. The drawback of using static is that it keeps its value between function calls: int bar() { return 42; } void foo() { static x = bar(); x += 5; writeln(x); } void main() { foo(); // 47 foo(); // 52 } So it may not be what you are looking for. Whereas if you use: void foo() { enum x = bar(); writeln(x + 5); } it will always write the same answer (and not allocate global space for it). BTW, that tour page needs updating, it has a few errors in it. -Steve
Mar 06 2018
On Tuesday, 6 March 2018 at 20:37:34 UTC, Steven Schveighoffer wrote:On 3/6/18 1:09 PM, Jordi Gutiérrez Hermoso wrote:Thanks for the explanation. I forgot about using enum instead. I think I've only briefly encountered it before. I'm aware of the global storage of static in this context. I like that it's the same keyword for static foreach; that's kind of what I was thinking when I wrote that just adding a static can result in compile-time execution.I wrote a blog post about working on Advent of Code in D. You can read it here: http://jordi.inversethought.com/blog/advent-of-d/I'm enjoying this. One thing jumped out at me: static does not mean execute at compile time (exactly), it really means allocate this data in thread-local storage.BTW, that tour page needs updating, it has a few errors in it.You mean the Dlang tour? I've been meaning for a while to be able to generate a url to its Gems section but I've never managed to untangle its Vibe.d structure enough to do so.
Mar 06 2018
On Tuesday, 6 March 2018 at 20:37:34 UTC, Steven Schveighoffer wrote:What triggers the compile-time execution is the fact that static *initializers* need to be decided at compile time. So while it is executing the regex building at compile time in your example, there are other ways to do it, and in this case, I'd prefer using an enum. You can also use ctRegex. The drawback of using static is that it keeps its value between function calls:What about static immutable? I think enums exist only for compiler but they're not a l-value, so you can't take a reference, am I wrong? Andrea
Mar 07 2018
On 3/7/18 3:20 AM, Andrea Fontana wrote:On Tuesday, 6 March 2018 at 20:37:34 UTC, Steven Schveighoffer wrote:Static immutable works (and makes sense as a static variable) if you can use it as immutable. I'm not sure regex can do that. enums force the compile time execution, then you need to generate a runtime value from the result. i.e.: enum Xval = someCTFEfunction(); // run at CTFE. auto x = Xval; // no calls, just pastes the result there. -SteveWhat triggers the compile-time execution is the fact that static *initializers* need to be decided at compile time. So while it is executing the regex building at compile time in your example, there are other ways to do it, and in this case, I'd prefer using an enum. You can also use ctRegex. The drawback of using static is that it keeps its value between function calls:What about static immutable? I think enums exist only for compiler but they're not a l-value, so you can't take a reference, am I wrong?
Mar 07 2018
On Tuesday, 6 March 2018 at 18:09:21 UTC, Jordi Gutiérrez Hermoso wrote:I wrote a blog post about working on Advent of Code in D. You can read it here: http://jordi.inversethought.com/blog/advent-of-d/on Day 8, I think the original "verbose" code is better in the end. Mixin at least for me makes it a bit less clear on what exactly is going on. On the other hand the latter version is probably easier to maintain and more copy-paste-error-proof.
Mar 06 2018
On Tuesday, 6 March 2018 at 21:03:47 UTC, JN wrote:On Tuesday, 6 March 2018 at 18:09:21 UTC, Jordi Gutiérrez Hermoso wrote:Yeah, it's mostly the C&P that I wanted to get rid of. I do wish the static foreach had worked, though! It's odd that you can't have compile-time associative arrays.I wrote a blog post about working on Advent of Code in D. You can read it here: http://jordi.inversethought.com/blog/advent-of-d/on Day 8, I think the original "verbose" code is better in the end. Mixin at least for me makes it a bit less clear on what exactly is going on. On the other hand the latter version is probably easier to maintain and more copy-paste-error-proof.
Mar 06 2018
On Tue, 2018-03-06 at 18:09 +0000, Jordi Guti=C3=A9rrez Hermoso via Digitalmars-d wrote:I wrote a blog post about working on Advent of Code in D. You can=20 read it here: =20 http://jordi.inversethought.com/blog/advent-of-d/Another blog post deserving of formal publication in an ACCU journal. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
Mar 07 2018
On Wednesday, 7 March 2018 at 21:35:06 UTC, Russel Winder wrote:On Tue, 2018-03-06 at 18:09 +0000, Jordi Gutiérrez Hermoso via Digitalmars-d wrote:Hm, I quickly looked at what that is. Some sort of informal journal? You think if I adapted the blog post for a print publication, they would take it?I wrote a blog post about working on Advent of Code in D. You can read it here: http://jordi.inversethought.com/blog/advent-of-d/Another blog post deserving of formal publication in an ACCU journal.
Mar 08 2018
On Thu, 2018-03-08 at 21:00 +0000, Jordi Guti=C3=A9rrez Hermoso via Digitalmars-d wrote:On Wednesday, 7 March 2018 at 21:35:06 UTC, Russel Winder wrote:The journals take a mix of articles written for the journal and blog posts adapted for the journal. So yes. I have taken the liberty of cc-ing the editors of the two journals so as to make the connection. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.ukOn Tue, 2018-03-06 at 18:09 +0000, Jordi Guti=C3=A9rrez Hermoso via=20 Digitalmars-d wrote:=20 Hm, I quickly looked at what that is. Some sort of informal=20 journal? You think if I adapted the blog post for a print=20 publication, they would take it?I wrote a blog post about working on Advent of Code in D. You=20 can read it here: =20 http://jordi.inversethought.com/blog/advent-of-d/=20 Another blog post deserving of formal publication in an ACCU=20 journal.
Mar 09 2018