# Difference between \`new\` and \`new{T}\`

**URL:** <https://discourse.julialang.org/t/difference-between-new-and-new-t/4707>\
**Category:** General Usage\
**Created:** [July 7, 2017, 3:36am UTC](https://discourse.julialang.org/t/difference-between-new-and-new-t/4707 "2017-07-07T03:36:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Post date:** [July 7, 2017, 3:36am UTC](https://discourse.julialang.org/t/difference-between-new-and-new-t/4707/1 "2017-07-07T03:36:36Z")

</div>

I understand `new{T}(...)` must be used instead of `new(...)` to define an outer constructor inside `struct ... end` (to define an [outer-only constructor](https://docs.julialang.org/en/stable/manual/constructors/#Outer-only-constructors-1), for example).

However, when defining an inner constructor, is there any difference between `new` and `new{T}`? For example, I wonder if there is any difference between the following two:

```julia
julia> struct MyType{T}
           x::T
           MyType{T}(x) where {T} = new(x)
       end

```

and

```julia
julia> struct MyType{T}
           x::T
           MyType{T}(x) where {T} = new{T}(x)
       end

```

One uses `new(...)` whereas the other uses `new{T}(...)`.

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [July 7, 2017, 4:24am UTC](https://discourse.julialang.org/t/difference-between-new-and-new-t/4707/2 "2017-07-07T04:24:38Z")

</div>

```julia
expand(
quote
    struct MyType{T}
        x::T
        MyType{T}(x) where {T} = new(x)
    end
end)

```

and

```julia
expand(
quote
    struct MyType{T}
        x::T
        MyType{T}(x) where {T} = new{T}(x)
    end
end)

```

are the same (apart from line number differences), so I don’t think there’s a difference.
