Improving Compiler Error Messages

Jacob Carlborg doob at me.com
Tue May 4 05:07:51 PDT 2010


On 5/3/10 22:06, Michel Fortin wrote:
> On 2010-05-03 15:33:53 -0400, Michel Fortin <michel.fortin at michelf.com>
> said:
>
>> On 2010-05-03 05:53:34 -0400, Jacob Carlborg <doob at me.com> said:
>>
>>> foo((int i) { writeln(i); });
>>
>> I agree that the semicolon looks out of place for one-line function
>> bodies.
>>
>> The semicolon could be made optional for the last statement in a
>> block. Just have it be a statement separator instead of a terminator.
>> That'd be consistent with commas in enums, array literals, and
>> function arguments.
>>
>> foo((int i) { writeln(i) });
>
> It could even be taken a little further: make the last statement the
> implicit return value of a function:
>
> { a < b } same as { return a < b; }
>
> Adding back the semicolon would bring back the current behaviour (it's
> just like adding an empty statement):
>
> { a < b; } same as { a < b; return; }
>
> It'd be nice for functional style predicates.

It would be nice to drop the brackets also, for one line delegates.



More information about the Digitalmars-d mailing list