Ok, I see. So I checked and in fact it doesn't have to be immutable, only
bit type.
I confirm that the following
type Sentinel{S}
end
foo(::Type{Sentinel{:Case1}}) = println("1")
foo(::Type{Sentinel{:Case2}}) = println("2")
foo(Sentinel{:Case1})
foo(Sentinel{:Case2})
works as expected.
Thanks again
Luca
On Tuesday, December 16, 2014 6:57:58 PM UTC+1, John Myles White wrote:
>
> I should probably point out that the type parameters being immutable is
> not quite right: the restriction is "any bits types", which you can assess
> using the isbits() function on a type's name. You can find more information
> here: https://github.com/JuliaLang/julia/issues/6081
>
> -- John
>
> On Dec 16, 2014, at 12:55 PM, Luca Antiga <[email protected]
> <javascript:>> wrote:
>
> > Hi John,
> > It didn't occur to me to try with immutable, it makes perfect sense now.
> > Thanks a lot for the hint and the explanation
> >
> > Luca
>
>