Dear Julia-dev, 
 first of all, a big hat off for Julia. I've started experimenting with it 
and I'm very very impressed.

While I was redesigning some code I had that I was porting to Julia, I kept 
reaching for dispatch based on a (constant) value of an argument, like

foo(:a, arg1, arg2) -> do something

foo(:b, arg1, arg2) -> do something else

This is something one could achieve with Haskell's data constructors or 
Clojure's multimethods and it's convenient. 

I'm aware of PatternDispatch.jl, but maybe just allowing a type to be 
parameterized with a particular value, like Type{:a} (or ValueType{:a}, for 
instance), could fit well in Julia's design of the type system and would 
not really have any overhead.

This would allow to write things like:

function foo(s::Type{:a}, arg1, arg2)
  do_something()
end

function foo(s::Type{:b}, arg1, arg2)
  do_something_else()
end

Of course it's totally possible I'm not getting Julia's design right, so I 
apologize in advance.

Thanks for such a great language, keep kicking!


Luca

Reply via email to