# How to resolve \`syntax: too few type parameters specified in "new{...}"\`?

**URL:** <https://discourse.julialang.org/t/how-to-resolve-syntax-too-few-type-parameters-specified-in-new/15766>\
**Category:** New to Julia\
**Created:** [October 2, 2018, 12:30am UTC](https://discourse.julialang.org/t/how-to-resolve-syntax-too-few-type-parameters-specified-in-new/15766 "2018-10-02T00:30:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [October 2, 2018, 12:30am UTC](https://discourse.julialang.org/t/how-to-resolve-syntax-too-few-type-parameters-specified-in-new/15766/1 "2018-10-02T00:30:40Z")

</div>

I am trying to define a tree node as a `mutable struct` in Julia v1.0, But I get the error

`syntax: too few type parameters specified in "new{...}"`

below is the MWE. Google points me to this [fully switch static parameter syntax to `where` · Issue #11310 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/11310), but the content is quite cryptic, so how do I fix this error? I have a feeling that it has something to with `T <: Real` but I don’t how to fix.

```julia
module JLBoostTrees
    mutable struct JLBoostTreeNode{T <: Real}
        weight::T
        children::Vector{JLBoostTreeNode}
        JLBoostTreeNode(w) = new(w, JLBoostTreeNode[])
    end
end

```

I am doing this on JuliaBox and I don’t have access to v0.7 at work, and I think there might others with the same question, so posting here for the benefit of all.

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [October 2, 2018, 12:41am UTC](https://discourse.julialang.org/t/how-to-resolve-syntax-too-few-type-parameters-specified-in-new/15766/2 "2018-10-02T00:41:08Z")

</div>

`new{typeof(w)}(...)`

---

<div class="post-metadata">

**Author:** ![jakewilliami](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakewilliami/32/18945_2.png) [@jakewilliami](https://discourse.julialang.org/u/jakewilliami)\
**Post date:** [January 2, 2021, 2:41am UTC](https://discourse.julialang.org/t/how-to-resolve-syntax-too-few-type-parameters-specified-in-new/15766/3 "2021-01-02T02:41:56Z")

</div>

For the mentally one-legged like myself: the answer by @mohamed82008 works in this case because their struct is defined as

```julia
mutable struct JLBoostTreeNode{T <: Real} ... end

```

If your struct has more than one types, e.g.

```julia
struct MyType{N, T} ... end

```

Then naturally you will need to provide `new` with all types it is expecting.

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [October 6, 2021, 6:32pm UTC](https://discourse.julialang.org/t/how-to-resolve-syntax-too-few-type-parameters-specified-in-new/15766/4 "2021-10-06T18:32:46Z")

</div>

There is this quote from the docs ([Constructors · The Julia Language](https://docs.julialang.org/en/v1/manual/constructors/), end of the page):

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/9/4950fda66ec7cfa7f2d7408ef282d8a0df6e11a2.png)

So why isn’t the type resolved automatically here?
