Feature or bug: print braces

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 14 14:55:39 PDT 2015


On Thursday, 14 May 2015 at 00:39:25 UTC, Dennis Ritchie wrote:
> On Thursday, 14 May 2015 at 00:33:33 UTC, Brian Schott wrote:
>> You told it to output a function literal, so it did.
>
> Yes, but it would be logical to deduce something like:
> -----
> writeln({}); // prints literal[{}]
>
> Or the compiler will not be able to distinguish the literal 
> from the ordinary function arguments?

Literal what?

Associative array? That uses square brackets, not curly brackets.
Struct? What struct would you be creating? And curly braces only 
works for initialization.
Lambda? Well you can omit the parameters if there are none, and 
`{}` in a lambda will give you a block to write, so `{}` is a 
valid lambda that accepts nothing and does nothing.


More information about the Digitalmars-d-learn mailing list