Re: [julia-users] Why does julia use END for block end?

2016-05-07 Thread Kevin Squire
Hi Didier,

Sorry to throw some cold water on your joke.  I half realized that it was a
joke at the end of your email.

One of the things we pride ourselves on is the welcoming nature of our
community.  We're not perfect, but we try pretty hard to keep conversation
respectful at the least. So when I or others see something that might be
construed as unwelcoming or disrespectful, we often speak up.

At this point, knowing you meant the message as a joke, I'd love to say
something snarky about lisp and parentheses... But the truth is I rather
like lisp. ;-)

Cheers!
   Kevin

On Saturday, May 7, 2016, Didier Verna  wrote:

> Kevin Squire > wrote:
>
> > That said, when it comes to opinions and holy wars, we very much like
> > it more peaceful around here.
>
>   That message was a joke, sorry if it was taken too seriously...
>
> --
> ELS'16, May 9-10, Krakow, Poland: http://www.european-lisp-symposium.org
>
> Lisp, Jazz, Aïkido: http://www.didierverna.info
>


Re: [julia-users] Why does julia use END for block end?

2016-05-07 Thread Didier Verna
Kevin Squire  wrote:

> That said, when it comes to opinions and holy wars, we very much like
> it more peaceful around here.

  That message was a joke, sorry if it was taken too seriously...

-- 
ELS'16, May 9-10, Krakow, Poland: http://www.european-lisp-symposium.org

Lisp, Jazz, Aïkido: http://www.didierverna.info


Re: [julia-users] Why does julia use END for block end?

2016-05-07 Thread Kevin Squire
Hi Didier,

I appreciate your recent interest in Julia, and especially that you've
uncovered a few inconsistencies/bugs that have been addressed, and I've
found many of your questions thought provoking.

That said, when it comes to opinions and holy wars, we very much like it
more peaceful around here.  Specifically, we discourage things like calling
someone's opinion "wrong" or "mistaken".  It's certainly ok to disagree,
but please do so respectfully.

Facts, of course, are subject to verification. ;-)

(I realize that much of what you wrote was tongue in cheek, and I'm not
taking exception with what you wrote--just how it was said.)

Cheers,
   Kevin

On Saturday, May 7, 2016, Didier Verna  wrote:

> DNF > wrote:
>
> > It is very clear and explicit, there is no doubt as to what it means,
> > unlike '}' which is way too small and ambiguous (does it mean end of
> > block, or end of dict definition, etc.), and just does not jump out at
> > you the way it should.
>
>   'end' is extremely verbose, just like 'function', 'global', 'local' etc.
>
>   You are also wrong about the curly brace's ambiguity. If you find it
>   ambiguous, that is because you live in a world overflown with
>   syntax. You don't need end of blocks or dict definitions to be
>   different things. You only really need an end of /expression/. And
>   BTW, I have a hard time figuring out why 'end' wouldn't be ambiguous
>   while '}' would be, especially since 'end' ends so many different
>   things in Julia.
>
>   Finally you are also mistaken about the size (yes, size matters). The
>   curly brace isn't too small. It's too big. It's too noisy. See this
>   little nasty peak in the middle, on the right? It's aggressive, it's
>   impolite, it hurts my eyes.
>
>   No, really, the only 'end' that makes sense, should be soft, discreet,
>   gentle, almost invisible, in perfect harmony with the
>   Universe. There's only one candidate. It's... the right parenthesis
>   ')'.
>
> --
> ELS'16, May 9-10, Krakow, Poland: http://www.european-lisp-symposium.org
>
> Lisp, Jazz, Aïkido: http://www.didierverna.info
>


Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread Adrian Salceanu
That's right Tim, it does work! Huhm... I can't exactly remember where I 
tripped into this one, as since I've abandoned this style and it's been a 
while. But yes, the explanation must be that the _first_ expression was not 
a boolean. 

Loving this, thanks very much! 

vineri, 6 mai 2016, 23:11:17 UTC+2, Tim Holy a scris:
>
> I think the problem was expr1, not expr2: you probably didn't make expr1 
> return a Bool. (Julia deliberately does not support "if cond" unless cond 
> is a 
> Bool.) 
>
> Demo of correct usage: 
>
> julia> x = 5 
> 5 
>
> julia> x == 4 && "hello" 
> false 
>
> julia> x == 5 && "world" 
> "world" 
>
> Best, 
> --Tim 
>
> On Friday, May 06, 2016 12:12:28 PM Adrian Salceanu 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. 
> > 
> > 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  > 
> > > 
> > > 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). 
>
>

Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread Adrian Salceanu
That's a good point, with the parenthesis it does work as expected in case 
of an assignment, thanks! 

vineri, 6 mai 2016, 22:31:42 UTC+2, Yichao Yu a scris:
>
> On Fri, May 6, 2016 at 3:12 PM, Adrian Salceanu 
>  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  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). 
> >> 
> >> 
> > 
>


Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread E. Tadeu
Then I guess we can get used to the end statement. I don’t see it as big
deal, it's just one extra line and after some coding we learn to ignore it.
;)
​

On Fri, May 6, 2016 at 6:09 PM, Stefan Karpinski 
wrote:

> Yes.
>
> On Fri, May 6, 2016 at 5:05 PM, E. Tadeu  wrote:
>
>> Is it too late to support dedentation (removing indentation) as a block
>> terminator, like in Python? :)
>>
>>
>> On Fri, May 6, 2016 at 5:42 PM, Tom Breloff  wrote:
>>
>>> Seems like a parser change is more correct.  What exactly does it mean
>>> to say "true = 5"?
>>>
>>> On Fri, May 6, 2016 at 4:31 PM, Yichao Yu  wrote:
>>>
 On Fri, May 6, 2016 at 3:12 PM, Adrian Salceanu
  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  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).
 >>
 >>
 >

>>>
>>>
>>
>


Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread Tim Holy
I think the problem was expr1, not expr2: you probably didn't make expr1 
return a Bool. (Julia deliberately does not support "if cond" unless cond is a 
Bool.)

Demo of correct usage:

julia> x = 5
5

julia> x == 4 && "hello"
false

julia> x == 5 && "world"
"world"

Best,
--Tim

On Friday, May 06, 2016 12:12:28 PM Adrian Salceanu 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.
> 
> 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 
> > 
> > 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).



Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread Stefan Karpinski
Yes.

On Fri, May 6, 2016 at 5:05 PM, E. Tadeu  wrote:

> Is it too late to support dedentation (removing indentation) as a block
> terminator, like in Python? :)
>
>
> On Fri, May 6, 2016 at 5:42 PM, Tom Breloff  wrote:
>
>> Seems like a parser change is more correct.  What exactly does it mean to
>> say "true = 5"?
>>
>> On Fri, May 6, 2016 at 4:31 PM, Yichao Yu  wrote:
>>
>>> On Fri, May 6, 2016 at 3:12 PM, Adrian Salceanu
>>>  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  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).
>>> >>
>>> >>
>>> >
>>>
>>
>>
>


Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread E. Tadeu
Is it too late to support dedentation (removing indentation) as a block
terminator, like in Python? :)


On Fri, May 6, 2016 at 5:42 PM, Tom Breloff  wrote:

> Seems like a parser change is more correct.  What exactly does it mean to
> say "true = 5"?
>
> On Fri, May 6, 2016 at 4:31 PM, Yichao Yu  wrote:
>
>> On Fri, May 6, 2016 at 3:12 PM, Adrian Salceanu
>>  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  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).
>> >>
>> >>
>> >
>>
>
>


Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread Tom Breloff
Seems like a parser change is more correct.  What exactly does it mean to
say "true = 5"?

On Fri, May 6, 2016 at 4:31 PM, Yichao Yu  wrote:

> On Fri, May 6, 2016 at 3:12 PM, Adrian Salceanu
>  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  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).
> >>
> >>
> >
>


Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread Yichao Yu
On Fri, May 6, 2016 at 3:12 PM, Adrian Salceanu
 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  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).
>>
>>
>


RE: [julia-users] Why does julia use END for block end?

2016-05-06 Thread David Anthoff
See also https://github.com/JuliaLang/julia/issues/6823 

 

From: stefan.karpin...@gmail.com [mailto:stefan.karpin...@gmail.com] On Behalf 
Of Stefan Karpinski
Sent: Friday, May 6, 2016 1:10 PM
To: Julia Users <julia-users@googlegroups.com>
Subject: Re: [julia-users] Why does julia use END for block end?

 

I proposed this once upon a time: 
https://github.com/JuliaLang/julia/issues/1657; it wasn't popular. Please don't 
start commenting on that long-dead issue – keep the discussion here instead.

 

On Fri, May 6, 2016 at 4:08 PM, Tom Short <tshort.rli...@gmail.com 
<mailto:tshort.rli...@gmail.com> > wrote:

You can make a quick macro for one-line if statements:

 

macro when(condition, expr)

esc(:( if $condition; $expr; end))

end

 

@when 4 > pi  x = 2

 

For even more compact syntax, you can replace `when` with `?`.

 

 

 

 

On Fri, May 6, 2016 at 3:12 PM, Adrian Salceanu <adrian.salce...@gmail.com 
<mailto:adrian.salce...@gmail.com> > 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. 



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 <ford...@gmail.com 
<mailto:ford...@gmail.com> > 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).

 

 

 



Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread Stefan Karpinski
I proposed this once upon a time:
https://github.com/JuliaLang/julia/issues/1657; it wasn't popular. Please
don't start commenting on that long-dead issue – keep the discussion here
instead.

On Fri, May 6, 2016 at 4:08 PM, Tom Short  wrote:

> You can make a quick macro for one-line if statements:
>
> macro when(condition, expr)
> esc(:( if $condition; $expr; end))
> end
>
> @when 4 > pi  x = 2
>
> For even more compact syntax, you can replace `when` with `?`.
>
>
>
>
> On Fri, May 6, 2016 at 3:12 PM, Adrian Salceanu  > 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.
>>
>>
>> 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  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).

>>>
>>>
>


Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread Tom Short
You can make a quick macro for one-line if statements:

macro when(condition, expr)
esc(:( if $condition; $expr; end))
end

@when 4 > pi  x = 2

For even more compact syntax, you can replace `when` with `?`.




On Fri, May 6, 2016 at 3:12 PM, Adrian Salceanu 
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.
>
>
> 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  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).
>>>
>>
>>


Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread Adrian Salceanu
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. 


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  
> 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).
>>
>
>

Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread Ford Ox
Good that I didnt meet them yet :]


Re: [julia-users] Why does julia use END for block end?

2016-05-06 Thread Stefan Karpinski
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  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).
>


[julia-users] Why does julia use END for block end?

2016-05-06 Thread Ford Ox
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).