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

**URL:** <https://discourse.julialang.org/t/function-f-t-a-a-where-a-vs-f-t-a-a-where-a/28746>\
**Category:** General Usage\
**Tags:** syntax\
**Created:** [September 14, 2019, 12:30am UTC](https://discourse.julialang.org/t/function-f-t-a-a-where-a-vs-f-t-a-a-where-a/28746 "2019-09-14T00:30:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![o314](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/o314/32/252_2.png) [@o314](https://discourse.julialang.org/u/o314)\
**Post date:** [September 14, 2019, 12:30am UTC](https://discourse.julialang.org/t/function-f-t-a-a-where-a-vs-f-t-a-a-where-a/28746/1 "2019-09-14T00:30:14Z")

</div>

Suppose we have a parametric type

```julia
using Test

struct T{A} end

```

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

```julia
function f(::T{A})::A where A
    one(A)
end

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

```

The short form however fails to parse.

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

```

This short one parse.

```julia
(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 ?

---

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [September 14, 2019, 3:16am UTC](https://discourse.julialang.org/t/function-f-t-a-a-where-a-vs-f-t-a-a-where-a/28746/2 "2019-09-14T03:16:05Z")

</div>

Yes, the parenthesis specifies the scope of `where`

---

<div class="post-metadata">

**Author:** ![o314](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/o314/32/252_2.png) [@o314](https://discourse.julialang.org/u/o314)\
**Post date:** [September 14, 2019, 4:58am UTC](https://discourse.julialang.org/t/function-f-t-a-a-where-a-vs-f-t-a-a-where-a/28746/3 "2019-09-14T04:58:15Z")

</div>

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…
