Why is there no or or and ?

Nick Sabalausky a at a.a
Thu Feb 16 23:19:51 PST 2012

"F i L" <witte2008 at gmail.com> wrote in message 
news:simejelbyihexcsbkoyl at forum.dlang.org...
>I would use them over '||' and '&&' for the reasons bearophile gave. 
>Highlighted as keywords, they're easily set appart, easier to type, and 
>more distinguished... then again if I had my way I'd remove the '('/')' 
>brackets, ending marks, and auto keyword; switched the definition name-type 
>placement and change if/else/return/contract syntax...
>     foo( a, b: float ): int

In other languages, I can live with JS-style "var:Type" but I've never 
really liked it. Just seems totally backwards to me:

1. When I declare a variable, I normally know the type I want before I know 
what to name it, so just typing it in is backwards.

2. With function definitions, why is the return type so rediculously far 
away from the function name? Should be "foo:int( a, b: float )". Besides, 
when you call the func and assign the return value to a variable, the return 
value is going to the left, not the right. In C-style, return values/types 
move "left". In JS-style, it's all willy-nilly.

3. Makes it harder to distinguish declarations from assignments at a glance. 
You have to look in the middle of the statement to see what the heck it is. 
With C-style you only have to look at the beginning (which are conveniently 
all lined up): Starts with a variable? Assignment. Starts with a type or 
attribute? Declaration. Starts with colored text? *Definitely* declaration. 
Don't see why languages keep trying to marginalize the idea of declarations.

4. Initializers are just downright goofy:

a:int = 5;

Looks like it's assigning 5 to "int" instead of to "a", which is completely 

More information about the Digitalmars-d mailing list