Awesome! I didn't know about Val... thanks Kevin.
On Friday, July 10, 2015 at 5:02:49 PM UTC-4, Kevin Squire wrote: > > It actually exists in Julia v0.4, as the `Val` type: > > julia> @enum Fruit apple orange banana > > julia> apple > apple::Fruit > > julia> isbits(apple) > true > > julia> function what_am_i{T}(::Val{T}) > println("I'm a $T, of type $(typeof(T))") > end > what_am_i (generic function with 1 method) > > julia> what_am_i(Val{apple}()) > I'm a apple, of type Fruit > > julia> what_am_i(Val{orange}()) > I'm a orange, of type Fruit > > Cheers, > Kevin > > On Fri, Jul 10, 2015 at 1:57 PM, Tom Breloff <t...@breloff.com > <javascript:>> wrote: > >> As far as I know, this would require the ability to dispatch on values in >> general, since enum values are just const instances of an immutable type. >> I know this feature has been requested (and I'd certainly make use of it as >> well), but I'm not sure I'd expect it anytime soon. >> >> >> On Friday, July 10, 2015 at 4:38:15 PM UTC-4, Jeffrey Sarnoff wrote: >>> >>> Or, is dispatch on enum values planned? >>> Can I tell when a function parameter will dispatch on its arg value at >>> compile-time? >>> thanks. >>> >> >