Feature or bug: print braces

Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 14 15:39:54 PDT 2015


On Thursday, 14 May 2015 at 21:55:40 UTC, Alex Parrill wrote:
> 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.

I just wanted to say that writeln function of demand should not 
print anything else at this challenge, not 804CF88 :)

-----
writeln({});


More information about the Digitalmars-d-learn mailing list