# Weird Constructor Parameter Problem

**URL:** <https://discourse.julialang.org/t/weird-constructor-parameter-problem/10769>\
**Category:** General Usage\
**Created:** [May 7, 2018, 9:41pm UTC](https://discourse.julialang.org/t/weird-constructor-parameter-problem/10769 "2018-05-07T21:41:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [May 7, 2018, 9:41pm UTC](https://discourse.julialang.org/t/weird-constructor-parameter-problem/10769/1 "2018-05-07T21:41:44Z")

</div>

```nohighlight
julia> abstract type Environment end

julia> abstract type SymTable{mutability} <: Environment end

julia> mutable struct BigSymTable{M<:Bool} <: SymTable{M}
               dict::Dict{Symbol,Any}
               BigSymTable{M}(dict::Dict{Symbol,T} = Dict{Symbol,Any}()) where T where M = new{M}(dict)
       end

julia> BigSymTable{false}()
ERROR: TypeError: BigSymTable: in M, expected M<:Bool, got Bool

```

What is wrong with this picture?  
Thanks

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [May 7, 2018, 10:12pm UTC](https://discourse.julialang.org/t/weird-constructor-parameter-problem/10769/2 "2018-05-07T22:12:46Z")

</div>

`false` (a value) is not a subtype of `Bool` (a type) and thus `false <: Bool` fails. You can drop the `<: Bool` part and it should be fine.

---

<div class="post-metadata">

**Author:** ![anon94023334](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Post date:** [May 7, 2018, 10:13pm UTC](https://discourse.julialang.org/t/weird-constructor-parameter-problem/10769/3 "2018-05-07T22:13:05Z")

</div>

~~Arguments to type parameters need to be types, not instances of types:~~

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [May 8, 2018, 1:59am UTC](https://discourse.julialang.org/t/weird-constructor-parameter-problem/10769/4 "2018-05-08T01:59:15Z")

</div>

> [@anon94023334](#):
>
> Arguments to type parameters need to be types, not instances of types:

That’s definitely common, but it doesn’t have to be the case. For example, in `Array{Int, 2}` the `2` is a value, not a type. Likewise in the OP’s case, `BigSymTable{false}` is a perfectly reasonable type parameter.

---

<div class="post-metadata">

**Author:** ![anon94023334](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Post date:** [May 8, 2018, 2:19am UTC](https://discourse.julialang.org/t/weird-constructor-parameter-problem/10769/5 "2018-05-08T02:19:55Z")

</div>

You’re right. Sorry for the misinformation.
