Improving Compiler Error Messages

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon May 3 13:07:34 PDT 2010


Nick Sabalausky wrote:
> "Michel Fortin" <michel.fortin at michelf.com> wrote in message 
> news:hrn8f1$tv2$1 at digitalmars.com...
>> 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) });
>>
> 
> Yea, that's a case of optional-semicolon that even I'd like to have (And 
> I've suggested it before). 

Actually that doesn't work as well as one might expect. In the Cecil 
language, the return type of a function would depend on whether it ended 
with a semicolon (void if present, something else if absent). Not very 
robust.

Andrei


More information about the Digitalmars-d mailing list