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

wilburtownsend picture wilburtownsend  ·  3Comments

omus picture omus  ·  3Comments

ararslan picture ararslan  ·  3Comments

iamed2 picture iamed2  ·  3Comments

thofma picture thofma  ·  3Comments