Julia: +(x::T,y::T) where {T} not parsing correctly

Created on 19 Apr 2017  路  3Comments  路  Source: JuliaLang/julia

Not sure if this is expected or not but the following declaration does not parse
+(x::T,y::T) where {T} = #

whereas this correctly does
+{T}(x::T,y::T) = #

I know it works if you use parenthesis, but there seems to be an inconsistency when there is no parens.

bug parser

Most helpful comment

The version without parentheses should in my opinion be disallowed. +(1, 2) still looks like a unary operator applied to a tuple.

All 3 comments

The version without parentheses should in my opinion be disallowed. +(1, 2) still looks like a unary operator applied to a tuple.

(+)(1, 2) or (+(1, 2)) still looks like an unary operator applied to a tuple, though.

(+(1, 2)) does, but (+)(1, 2) is fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ararslan picture ararslan  路  3Comments

thofma picture thofma  路  3Comments

StefanKarpinski picture StefanKarpinski  路  3Comments

iamed2 picture iamed2  路  3Comments

i-apellaniz picture i-apellaniz  路  3Comments