why ; ?

Daniel Giddings daniel.giddings at gmail.com
Tue May 6 16:30:16 PDT 2008


; also works in Python as a line separator:

print "a" ; print "b"

and it gives quite good syntax error messages

Personally I'm more in favor of the Python style code as opposed to C 
style code, because while you might need a \ line break char for some 
code, it is very much the exception to the rule - saving quite an amount 
of hassle.

:-) Dan

Michael Neumann wrote:
> Tom wrote:
>  > Tomasz Sowinski escribió:
>  >> Robert Fraser Wrote:
>  >>
>  >>> So the end of a statement would be marked by a newline character a la
>  >>> Python?
>  >>
>  >> yes
>  >>
>  >>> 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".
>  >>
>  >> Maybe a breakline symbol like in Ruby or VB for long statements?
>  >>
>  >
>  > Please no!
> 
> It is very successful in Ruby! But Ruby is a very different language.
> Ruby allows you to separate statements with ";" in one line. And it
> recognises statements that cross a line boundary like shown below:
> 
>   a +
>   b
>   ==> a + b
> 
>   a
>   + b
>   ==> a; +b (probably not what you want!)
> 
> One problem is clearly (as Walter said) that reporting syntax errors can
> become hard, or very unprecise. The latter is the case in Ruby.
> 
> Regards,
> 
>   Michael



More information about the Digitalmars-d mailing list