April 21, 2017
On Thursday, 20 April 2017 at 07:37:17 UTC, Mike Parker wrote:
> On Thursday, 20 April 2017 at 05:01:17 UTC, Adrian Matoga wrote:
>> On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:
>>>
>>> Thank you. Has this been on Reddit yet?
>>
>> I haven't posted it there, I don't have an account.
>
> I'll post it, but not today. It will get more attention if I wait until Friday afternoon GMT.

https://www.reddit.com/r/programming/comments/66ovil/metaprogramming_is_less_fun_in_d/
April 21, 2017
On Friday, 21 April 2017 at 12:34:53 UTC, Mike Parker wrote:
> On Thursday, 20 April 2017 at 07:37:17 UTC, Mike Parker wrote:
>> On Thursday, 20 April 2017 at 05:01:17 UTC, Adrian Matoga wrote:
>>> On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:
>>>>
>>>> Thank you. Has this been on Reddit yet?
>>>
>>> I haven't posted it there, I don't have an account.
>>
>> I'll post it, but not today. It will get more attention if I wait until Friday afternoon GMT.
>
> https://www.reddit.com/r/programming/comments/66ovil/metaprogramming_is_less_fun_in_d/

And I should add (for anyone paying attention), this is exactly the sort of thing I'm looking for more of on the D Blog. Submissions welcome :-)
April 21, 2017
On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:
> [2] https://epi.github.io/2017/03/18/less_fun.html

BTW in your D foreach, you could also have done `switch`

  void trigger(string event) {
    switch(event) {
      foreach (i, e; events) {
        case e:
          foreach (c; callbacks_[i])
            c();
          return;
      }
      default:
           assert(false, "trying to trigger an unknown event: " ~ event);
    }
  }


And the compiler+runtime can optimize that into a binary search when it gets larger automatically.
April 21, 2017
On Friday, 21 April 2017 at 12:34:53 UTC, Mike Parker wrote:
> On Thursday, 20 April 2017 at 07:37:17 UTC, Mike Parker wrote:
>> On Thursday, 20 April 2017 at 05:01:17 UTC, Adrian Matoga wrote:
>>> On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:
>>>>
>>>> Thank you. Has this been on Reddit yet?
>>>
>>> I haven't posted it there, I don't have an account.
>>
>> I'll post it, but not today. It will get more attention if I wait until Friday afternoon GMT.
>
> https://www.reddit.com/r/programming/comments/66ovil/metaprogramming_is_less_fun_in_d/

Nice work, already made the top 20 upvoted proggit links this week:

https://www.reddit.com/r/programming/top/?time=week

Active discussion going on, liked this Q&A:

https://www.reddit.com/r/programming/comments/66ovil/comment/dgkjnh6
April 21, 2017
On Friday, 21 April 2017 at 12:34:53 UTC, Mike Parker wrote:
> On Thursday, 20 April 2017 at 07:37:17 UTC, Mike Parker wrote:
>> On Thursday, 20 April 2017 at 05:01:17 UTC, Adrian Matoga wrote:
>>> On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:
>>>>
>>>> Thank you. Has this been on Reddit yet?
>>>
>>> I haven't posted it there, I don't have an account.
>>
>> I'll post it, but not today. It will get more attention if I wait until Friday afternoon GMT.
>
> https://www.reddit.com/r/programming/comments/66ovil/metaprogramming_is_less_fun_in_d/

Thanks!

Maaan, reddit takes ages to load on mobile and doesn't let me read anything until I close all these annoying popups. Yet the comments are mostly in the same tone I saw a few times in the past when links were posted here ("D sucks" and so on) and made me think of reddit as a complete waste of time. It looks like it's all the time the same topic – bad, bad GC, D1 vs. D2, oh, and Rust and Go are better.

OTOH, I saw it posted also on HN (https://news.ycombinator.com/item?id=14165198)
and there, the discussion seems to be slightly more interesting.

April 21, 2017
On Friday, 21 April 2017 at 12:37:03 UTC, Mike Parker wrote:
> On Friday, 21 April 2017 at 12:34:53 UTC, Mike Parker wrote:
>> On Thursday, 20 April 2017 at 07:37:17 UTC, Mike Parker wrote:
>>> On Thursday, 20 April 2017 at 05:01:17 UTC, Adrian Matoga wrote:
>>>> On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:
>>>>>
>>>>> Thank you. Has this been on Reddit yet?
>>>>
>>>> I haven't posted it there, I don't have an account.
>>>
>>> I'll post it, but not today. It will get more attention if I wait until Friday afternoon GMT.
>>
>> https://www.reddit.com/r/programming/comments/66ovil/metaprogramming_is_less_fun_in_d/
>
> And I should add (for anyone paying attention), this is exactly the sort of thing I'm looking for more of on the D Blog. Submissions welcome :-)

This, and the generally positive feedback on r and HN are quite motivating. :)
I have some ideas for more articles but being a non-native English speaker I need a lot of time to make the text look at least understandable, so I usually give up quickly and move on to play with code instead. :)

April 21, 2017
On Friday, 21 April 2017 at 13:10:43 UTC, Adam D. Ruppe wrote:
> On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:
>> [2] https://epi.github.io/2017/03/18/less_fun.html
>
> BTW in your D foreach, you could also have done `switch`
>
>   void trigger(string event) {
>     switch(event) {
>       foreach (i, e; events) {
>         case e:
>           foreach (c; callbacks_[i])
>             c();
>           return;
>       }
>       default:
>            assert(false, "trying to trigger an unknown event: " ~ event);
>     }
>   }
>
>
> And the compiler+runtime can optimize that into a binary search when it gets larger automatically.

Thanks, I completely forgot about it. I should update the article soon.

April 21, 2017
On 4/19/2017 3:58 AM, Laeeth Isharc wrote:
> I think not enough has been written on D's plasticity - Andrei and Walter talk
> about it in passing a couple of times.  But I have the impression that it's
> maybe quite important for merits of D's real world commercial value. Compare
> using refactoring  tools with not really needing them to same extent.

It's a really hard idea to get across.

Back when I wrote in C and C++, usually the first algorithm and data structure I picked persisted through to the end of life of the program. I'd optimize the hell out of it, but I didn't change it.

But with D, I find I redo the algorithms and data structures, trying to find one that works better. The Warp project is a particular example of that.

In C/C++, changing the algorithm/data structure meant rewriting the program. D makes it easy to change that without major rewrites, so it's much more likely that I'll be willing to change it.

Other explanations for this are:

1. I'm better at encapsulating algorithms and data structures

2. D's unit test feature makes me much more confident in making changes.

I can't help but think it is more than that. In D my programs just go together faster, and have fewer bugs. The code tends to look more like a solution to the problem rather than a mass of ->::<> and other syntax.

But these things are hard to get across in a presentation, so instead I talk about features, and the audience goes "well I can do that in C++/Rust/Go" even if it is awkward or requires a 3rd party tool or whatever.
April 22, 2017
Am Wed, 19 Apr 2017 18:02:46 +0000
schrieb Adrian Matoga <dlang.spam@matoga.info>:

> On Wednesday, 19 April 2017 at 08:19:52 UTC, Ali Çehreli wrote:
> > I'm brushing up on my C++ to prepare for my C++Now 2017 presentation[1]. boost::hana is an impressive library that overlaps with many D features:
> >
> > 
> > http://www.boost.org/doc/libs/1_64_0_b2/libs/hana/doc/html/index.html
> >
> > Have you used boost::hana? What are your thoughts on it?
> >
> > And please share your ideas for the presentation. There has been threads here about C++ closing the gap. Does D still bring competitive advantage or is it becoming irrelevant? (Obviously, some think its irrelevant already.) I'm trying to collect opinions... :)
> >
> > Thank you,
> > Ali
> >
> > [1] http://cppnow.org/2017-conference/announcements/2017/04/09/d-keynote.html
> 
> I was at C++ Meeting 2016 in Berlin, where Louis Dionne talked
> about hana in his keynote [1]. I've summarized my feelings in a
> blog post [2]. In short, you can do the same tricks in D, but
> frequently there's an idiomatic way to express the same thing
> just as concisely without them.
> And of course, feel free to use any part of my post in your talk.
> :)
> 
> [1] https://www.youtube.com/watch?v=X_p9X5RzBJE
> [2] https://epi.github.io/2017/03/18/less_fun.html
> 

OT but is there any benefit to identify events with strings? As long as you use compile time only events I'd prefer a syntax as in https://github.com/WebFreak001/EventSystem

(one benefit is that it's 100% IDE autocomplete compatible)

I guess if you want runtime registration of events identifying by name is useful. But then you also somehow have to encode the parameter types to make the whole thing safe...

-- Johannes

April 22, 2017
On Saturday, 22 April 2017 at 07:53:49 UTC, Johannes Pfau wrote:
>> 
>> [1] https://www.youtube.com/watch?v=X_p9X5RzBJE
>> [2] https://epi.github.io/2017/03/18/less_fun.html
>> 
>
> OT but is there any benefit to identify events with strings? As long as you use compile time only events I'd prefer a syntax as in https://github.com/WebFreak001/EventSystem
>
> (one benefit is that it's 100% IDE autocomplete compatible)
>
> I guess if you want runtime registration of events identifying by name is useful. But then you also somehow have to encode the parameter types to make the whole thing safe...
>
> -- Johannes

I don't know about events, but dcd uses things like token!"+=" instead of giving it a name, I think it is very readable, waaaaay better than php's T_pajamajama or whatever it is/was.