Multiple dispatch is actually really well suited for this. The idiomatic 
approach in Julia is quite similar to your c++ example, at least conceptually:

immutable Foo end
immutable Bar end

alg(::Type{Foo}) = println("I'm using foo") 
alg(::Type{Bar}) = println("I'm using bar") 

strategy = Foo # or Bar 
alg(strategy) 

// T 

Reply via email to