Re: Advent of D

2018-03-09 Thread Russel Winder via Digitalmars-d
On Thu, 2018-03-08 at 21:00 +, Jordi Gutiérrez Hermoso via
Digitalmars-d wrote:
> On Wednesday, 7 March 2018 at 21:35:06 UTC, Russel Winder wrote:
> > On Tue, 2018-03-06 at 18:09 +, Jordi Gutiérrez Hermoso via 
> > Digitalmars-d 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/
> > 
> > Another blog post deserving of formal publication in an ACCU 
> > journal.
> 
> 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?

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.

-- 
Russel.
===
Dr Russel Winder  t: +44 20 7585 2200
41 Buckmaster Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk


signature.asc
Description: This is a digitally signed message part


Re: "Advent of D" article on Reddit

2018-03-09 Thread bauss via Digitalmars-d-announce

On Friday, 9 March 2018 at 05:47:08 UTC, sarn wrote:

On Friday, 9 March 2018 at 05:34:31 UTC, bauss wrote:

Lmao I love Reddit.

The D hate has moved onto a new level.

Instead of hating on D, it's now geared towards the amount of 
upvotes a D post on reddit gets.


What an amusement.


To be fair, some things get posted to /r/programming that 
really should stay on /r/d_language.  Spamming doesn't create a 
good image.


Yes, but this is not one of those things.


Re: "Advent of D" article on Reddit

2018-03-08 Thread sarn via Digitalmars-d-announce

On Friday, 9 March 2018 at 05:34:31 UTC, bauss wrote:

Lmao I love Reddit.

The D hate has moved onto a new level.

Instead of hating on D, it's now geared towards the amount of 
upvotes a D post on reddit gets.


What an amusement.


To be fair, some things get posted to /r/programming that really 
should stay on /r/d_language.  Spamming doesn't create a good 
image.


Re: "Advent of D" article on Reddit

2018-03-08 Thread bauss via Digitalmars-d-announce

On Thursday, 8 March 2018 at 21:19:25 UTC, Ali Çehreli wrote:

Reposting here from the main newsgroup:


https://www.reddit.com/r/programming/comments/82xyu6/advent_of_d_learning_d_with_advent_of_code/

Ali


Lmao I love Reddit.

The D hate has moved onto a new level.

Instead of hating on D, it's now geared towards the amount of 
upvotes a D post on reddit gets.


What an amusement.


Re: Advent of D

2018-03-08 Thread Ali Çehreli via Digitalmars-d

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



Re: Advent of D

2018-03-08 Thread Jordi Gutiérrez Hermoso via Digitalmars-d

On Wednesday, 7 March 2018 at 21:35:06 UTC, Russel Winder wrote:
On Tue, 2018-03-06 at 18:09 +, Jordi Gutiérrez Hermoso via 
Digitalmars-d 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/


Another blog post deserving of formal publication in an ACCU 
journal.


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?


Re: Advent of D

2018-03-07 Thread Russel Winder via Digitalmars-d
On Tue, 2018-03-06 at 18:09 +, Jordi Gutiérrez Hermoso via
Digitalmars-d 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/

Another blog post deserving of formal publication in an ACCU journal.

-- 
Russel.
===
Dr Russel Winder  t: +44 20 7585 2200
41 Buckmaster Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk


signature.asc
Description: This is a digitally signed message part


Re: Advent of D

2018-03-07 Thread Andrei Alexandrescu via Digitalmars-d

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:


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/ 


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,

Andrei



Re: Advent of D

2018-03-07 Thread Jordi Gutiérrez Hermoso via Digitalmars-d

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:


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/


Ah, I see. Pity. Maybe it'll get rediscovered in a few months and 
people will post it again.


Re: Advent of D

2018-03-07 Thread Steven Schveighoffer via Digitalmars-d

On 3/7/18 3:20 AM, Andrea Fontana wrote:

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?


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.

-Steve


Re: Advent of D

2018-03-07 Thread Mike Parker via Digitalmars-d
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/


Re: Advent of D

2018-03-07 Thread Jordi Gutiérrez Hermoso via Digitalmars-d

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:
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.


Ah, well. Someone had already submitted it. And completely 
missed the window :-(


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?


Re: Advent of D

2018-03-07 Thread Mike Parker via Digitalmars-d

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:




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.


Ah, well. Someone had already submitted it. And completely missed 
the window :-(


Re: Advent of D

2018-03-07 Thread Andrea Fontana via Digitalmars-d
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


Re: Advent of D

2018-03-06 Thread Mike Parker via Digitalmars-d
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.


Re: Advent of D

2018-03-06 Thread Adam D. Ruppe via Digitalmars-d
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?


Re: Advent of D

2018-03-06 Thread Jordi Gutiérrez Hermoso via Digitalmars-d
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:
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.


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.



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.




Re: Advent of D

2018-03-06 Thread Jordi Gutiérrez Hermoso via Digitalmars-d

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:
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.


Yeah, it's mostly the C 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.




Re: Advent of D

2018-03-06 Thread Jordi Gutiérrez Hermoso via Digitalmars-d

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


Re: Advent of D

2018-03-06 Thread JN via Digitalmars-d
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.




Re: Advent of D

2018-03-06 Thread Steven Schveighoffer via Digitalmars-d

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


Re: Advent of D

2018-03-06 Thread Patrick Schluter via Digitalmars-d
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.


Re: Advent of D

2018-03-06 Thread Joakim via Digitalmars-d
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.


Re: Advent of D

2018-03-06 Thread David Gileadi via Digitalmars-d

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!