On Fri, May 6, 2016 at 3:12 PM, Adrian Salceanu
<[email protected]> wrote:
> The only place where I find the "end" requirement annoying is for one line
> IF statements. When you have a short one liner, the "end" part just does not
> feel right. It would be nice if the "end" could be left out for one liners.
> Even PHP allows one to skip the accolades in such cases.
>
> If there's some other way of achieving this I'd love to hear about it. I
> don't like the ternary operator in this situation cause it forces me to add
> the 3rd part as "nothing" or whatever. And doing "expr1 && expr2" only works
> when expr2 is "return" for instance, otherwise the compiler complains about
> using a non-boolean in a boolean context.

It shouldn't. Unless you are using the result in a boolean context.
The only case where this doesn't work is assignment, where `a && b =
c` is parsed as `(a && b) = c` and not `a && (b = c)`. This can be
workaround by adding parenthesis as shown above and maybe we can also
change the parser too?

>
>
> vineri, 6 mai 2016, 20:37:49 UTC+2, Stefan Karpinski a scris:
>>
>> There is a long history of languages using this syntax, including Algol,
>> Pascal, Ruby and Matlab.
>>
>> On Fri, May 6, 2016 at 2:26 PM, Ford Ox <[email protected]> wrote:
>>>
>>> Is there any reasoning behind it? It seems to me like a weird choice
>>> since you have to type three letters, which is the complete opposite of the
>>> goal of this language - being very productive (a lot work done with little
>>> code).
>>> On top of that, brain has to read the word every time your eyes look at
>>> it so you spend more time also reading the code - tho this should be easy to
>>> omit, by highlighting this keyword by other color than other keywords (the
>>> current purple color in ATOM just drives me crazy, since it is one of the
>>> most violent colors, so my eyes always try to read that useless piece of
>>> information first, instead of the important code).
>>
>>
>

Reply via email to