February 15, 2018
On Thursday, 15 February 2018 at 16:22:17 UTC, Steven Schveighoffer wrote:
> On 2/13/18 6:35 PM, Seb wrote:
>> Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much:
>> 
>> https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d
>> 
>> It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.
>
> Nice article!

Thanks!

> Typos and Grammar:

Thanks a lot!
Yeah I shouldn't have published it directly after writing it...

> This part is slightly incorrect:

Good point! Thanks.
I reworded the entire paragraph and it now shows the AST:

https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d/#4-whats-up-with-this-enforce

My idea was that we have this subtextual message: "look, D isn't complicated and we can always look behind the scenes".
February 15, 2018
On 2/15/18 2:11 PM, Seb wrote:

> I reworded the entire paragraph and it now shows the AST:
> 
> https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d/#4-whats-up-with-this-enforce 

eh...

"string which is an alias for an array of const(char) elements"

It's not actually, it's an array of immutable(char) elements.

But I think the reason we see const(char)[] delegate and not immutable(char)[] delegate, is that enforce's actual signature is:

T enforce(E : Throwable = Exception, T)(T value, lazy const(char)[] msg = null, string file = __FILE__, size_t line = __LINE__)

Not lazy string as you originally said.

https://dlang.org/phobos/std_exception.html#.enforce

In fact, you can see "string" output by the AST generator in other places (e.g. void main(string[] args) ), so even that whole explanation that it has "resolved" string already is misleading ;)

BTW, I have to click on the AST button on run.dlang.io (at least on my browser) to see the generated AST, it's not done automatically.

> My idea was that we have this subtextual message: "look, D isn't complicated and we can always look behind the scenes".

I like the message, a lot! I think it's a very nice way to show some well-written D code while explaining each part so they make sense to outsiders.

-Steve
February 15, 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
> Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much:
>
> https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d
>
> It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.

Very well written. Nice read. I recommend you write more these days.
1 2 3 4 5
Next ›   Last »