On Sunday, May 31, 2015 at 7:13:47 AM UTC+2, Alex Ames wrote:
>
> I lost multiple days attempting to pin down this behavior. I had something 
> along the lines of
> x = a + b
>      + c
> It's not clear to me why the second line is a valid expression. At the 
> very least, it would be nice for lint to catch these, or an optional `...` 
> line-continuation operator.
>

I think that you are just thinking in terms of other languages... (real 
Julians please correct me if I make a mistake here!)

In Julia, almost everything is an expression (there are a very few things, 
like "import", "using", "return" which are not,
and there is an issue on GitHub about making "return" an expression...).
The end of a line will terminate an expression, unless for some reason it 
is unterminated... i.e. a closing `)`, `]`, `}`, the 2nd argument to a 
binary operator, and other things
are missing.   In the REPL you see this state immediately, because you 
don't get a result and a new "Julia>" prompt.
So... the +c is simply an expression, with the unary + applied to the value 
c.
Here is an example of perfectly valid (if useless) julia code (it adds a to 
c and returns c):

julia> function foo(a,b,c)
       c+=a
       x = a+b 
       +c 
       end 

foo (generic function with 1 method) 

julia> foo(1,2,3) 
4

>
> On Saturday, May 30, 2015 at 11:21:18 AM UTC-5, Gabriel Mihalache wrote:
>>
>> Once you spend a few days tracking down a bug due to this, you never 
>> forget. The idea would be to find a way to save people from this experience.
>>
>> Some lines are naturally long because e.g. the equation is long or 
>> because you prefer long, informative variable names. You can always use 
>> variables for parts of the expression but then that just feels like working 
>> around poor language features/design.
>>
>

Reply via email to