That was sort of what I was getting at, but I think it's overkill (not to 
mention not possible without significant additional complications).

> On Dec 26, 2013, at 10:01 PM, andrew cooke <[email protected]> wrote:
> 
> i still don't get how / when julia's types are dependent, but would it be 
> possible to make enums so that you could have something like:
> 
>  
> @enum Fruit APPLE BANANA
> 
> function peel_generic(f::Fruit, ...) ...
> function eat_apple(::Fruit{APPLE}, ...) ...
> function eat_banana(::Fruit{BANANA},...) ...
> 
> in other words, some way to get the best of both worlds - both a numeric 
> value and a (sub-)type that can be dispatched on?  i'm thinking that 
> Fruit{APPLE} is a bit like Array{..., 1} hence my mentioning dependent types.
> 
> i hope that's clear.  i suspect i am not using the right words and asking for 
> the impossible...
> 
> andrew

Reply via email to