That's great that it's fixed in 0.4, but even in 0.3.X I would still label 
it inconsistent behavior, or perhaps even a bug. Why should this happen:

*julia> **x.2 == x*.2*

*true*

*julia> **x0.2 == x*0.2*

*ERROR: x0 not defined*

*julia> **x2 == x*2*

*ERROR: x2 not defined*

It seems consistent that .2X == .2*X, 0.2X == 0.2*X, 2X == 2*X, so it is 
fine if the number occurs before the variable. But not if the number occurs 
after, so I agree with the proposal to ban X.2, meaning trigger an error. 
Shouldn't this be the case for 0.3 versions as well?


On Wednesday, June 17, 2015 at 9:14:24 AM UTC-4, Seth wrote:
>
>
>
> On Wednesday, June 17, 2015 at 8:04:11 AM UTC-5, Jerry Xiong wrote:
>>
>> Today I spend many time to find a bug in my code. It is turn out that I 
>> mistakenly wrote sum(X,2) as sum(X.2). No any error information is reported 
>> and Julia regarded X.2 as X*0.2. The comma "," is quite close to dot "." in 
>> the keyboard and looks quite similar in some fonts. As there is no any 
>> error occur, this bug will be dangerous. Also, it is not intuitive to 
>> understand X.2 is X*0.2. I think maybe it is better to forbid syntax like 
>> X.2 but only allowed .2X. 
>>
>
> This appears to be fixed in 0.4:
>
> julia> x = 100
> 100
>
> julia> x.2
> ERROR: syntax: extra token "0.2" after end of expression
>
> julia> sum(x.2)
> ERROR: syntax: missing comma or ) in argument list
>
> julia> f(x) = x.2
> ERROR: syntax: extra token "0.2" after end of expression
>
> julia> f(x) = sum(x.2)
> ERROR: syntax: missing comma or ) in argument list
>
>  
>

Reply via email to