One year of Go

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Nov 12 09:52:19 PST 2010


On 11/12/10 9:44 AM, bearophile wrote:
> Russel Winder:
>
>> I have to say I quite like not having to have semicolon
>> statement terminators.
>
> I too don't like to add the semicolon at the end of lines, I like to write Python code that doesn't need them, but in some languages (Scala, JavaScript) this has caused more problems than it solves. So the language needs to be designed to never require them at the end of lines and to have a not error prone syntax.
>
> Bye,
> bearophile

Same here. The problem is I don't want to remember arcana about the 
necessity of sometimes doing this and sometimes doing that. I first met 
optional semicolon in the Cecil language, where the last expression in a 
function would determine the result. So one would write:

method fun() { 42 }

to return an integer, and

method fun() { 42; }

to return void. This turned out to be a huge hassle, so I vaguely recall 
the rule was changed such that ";" at the end of the function was always 
ignored, thus making it difficult to write functions that return void.

Then I met it in Javascript, where the rule was confusing in similar 
ways; a sensible piece of advice that I followed was to always use 
semicolons. Finally, Go has yet other issues with the matter.

I guess only Python got that one right...


Andrei


More information about the Digitalmars-d mailing list