Figuring out the returntype opDipatch

Jacob Carlborg doob at me.com
Fri Nov 15 00:08:25 PST 2013


On 2013-11-14 22:02, TheFlyingFiddle wrote:
> After looking at the DIP some more i can see that my suggestion
> implementation does not make any sense (and i missed some of the
> syntax). If it can be done with AST's i don't have a sugestion for it.

If you have the an example like:

int a = foo.baz("Hello");

And the context parameter allows you do determine the type of "a", then 
it would be possible.

But you would still have problems with usages like these:

auto a = foo.baz("Hello");

And:

void bar (T) (T t) { }

bar(foo.baz("Hello"));

Both of these requires some fallback type.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list