Function f(::T{A})::A where A ... VS f(::T{A})::A where A

Suppose we have a parametric type

using Test

struct T{A} end

And a function above this type with an explicit return type.
Here is the long form. Works ok

function f(::T{A})::A where A

@test f(T{Int}()) == 1

The short form however fails to parse.

f(::T{A})::A where A = 2 * one(A)

This short one parse.

(f(::T{A})::A) where A = 3 * one(A)

@test f(T{Int}()) == 3

But is a bit ugly. Is it the right and expected shortened form or do i miss something ?

Yes, the parenthesis specifies the scope of where


Agree. On the deep language side, construct should scope the where.

I don’t find the surface language very readable however.

  • Is it an omission compared to the long form?
  • Do some additionals constraints (precedence issue maybe) raise at the short one and
    prevent to keep a more readable short syntax…
  • Is there a surface form more clear…

That’s all open issues for me…