On 2/15/18 2:11 PM, Seb wrote:
I reworded the entire paragraph and it now shows the AST:
"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.
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