why ; ?

downs default_357-line at yahoo.de
Mon May 5 02:25:17 PDT 2008


Robert Fraser wrote:
> Tomasz Sowinski wrote:
>> Just another feature thought. Never gonna happen, but still...
>>
>> What's the reason of having lines end with a semicolon? Anything else
>> than a legacy issue with C/C++?
>>
>> The only thing I can think of is having multiple statements in one
>> line, but that only makes code unreadable. Wouldn't getting rid of ;
>> improve readability?
>>
>>
>> Tomek
> 
> So the end of a statement would be marked by a newline character a la
> Python?

Why mark the end of statements at all?

Couldn't it be possible to have the compiler deduce the end of a statement automatically, by parsing as much as it can and then stopping?

void main() { writefln("Hello World") int a float b = 4 writefln(a, " - ", b) return 0 }
> 
> I usually like to keep my lines under 80 characters long for
> readability, and occasionally have long statements (especially if
> there's a ternary operator in there somewhere), so my vote is "nay".
> There are various other arguments against it, too (especially in that it
> makes parsing easier).

I vote in favor, as long as I can do multiple statements per line. It's useful sometimes. Maybe support "; "  as a fallback?

 --downs



More information about the Digitalmars-d mailing list