Yep, that's a much nicer way to do this. Note that with the new
higher-order functions work, Foo.f will probably be specialized for each
individual g, so if you're worried about code generation, this doesn't
really help. But then again, it's hard to imagine a function being called
from so many other modules that code generation becomes a huge problem.
Generally anything that is O(loc) is not a big issue.

On Wed, Feb 17, 2016 at 6:45 PM, Greg Plowman <greg_plow...@yahoo.com.au>
wrote:

>
> Not sure if this is helpful:
>
> module Foo
>     f(g,x) = g(x)
> end
>
> module X
>     using Foo
>     g(x) = 2x
>     f(x) = Foo.f(g,x)
> end
>
> module Y
>     using Foo
>     g(x) = 3x
>     f(x) = Foo.f(g,x)
> end
>
> X.f(4)
> Y.f(4)
>
>

Reply via email to