On Wed, Apr 29, 2015 at 6:07 PM, Scott Jones <[email protected]>
wrote:

>
> I think this is easier to solve than you think.
> The compiler should see this call as having a signature of Union(F,B),
> which *neither* Foo.f nor Bar.f have...
>

What does this mean?


> So, it can either, give an error,
>

What error? Why? You want a feature which, when used, is an error? Why have
the feature in the first place then?


> or be even smarter, and see that it should be equivalent to:
> rand(Bool) ? f(Foo.F()) : f(Bar.B()),
> which is *totally* determined statically!
>

That trick happens to work in this particular example, but you can easily
construct cases where that transformation can't be done. If the argument to
f is a function argument, for example. But it still has the exact same
problem.


> What's the real problem here?
>

Function merging has these problems:

   1. It complects name resolution with dispatch – they are no longer
   orthogonal.
   2. It makes all bindings from `using` semantically ambiguous – you have
   no idea what a name means without actually doing a call.

Reply via email to