retard wrote:
Tue, 01 Dec 2009 14:30:43 +0300, Denis Koroskin wrote:

On Tue, 01 Dec 2009 14:26:04 +0300, retard <r...@tard.com.invalid> wrote:

Tue, 01 Dec 2009 03:16:47 -0800, Walter Bright wrote:

Ary Borenszweig wrote:
Can you show examples of points 2, 3 and 4?
Have opDispatch look up the string in an associative array that
returns an associated delegate, then call the delegate.

The dynamic part will be loading up the associative array at run time.
This is not exactly what everyone of us expected. I'd like to have
something like

void foo(Object o) {
  o.duckMethod();
}

foo(new Object() { void duckMethod() {} });

The feature isn't very dynamic since the dispatch rules are defined
statically. The only thing you can do is rewire the associative array
when forwarding statically precalculated dispatching.
I believe you should distinguish duck types from other types.

You shouldn't be able to call duckMethod given a reference to Object,
it's a statically-typed language, after all.

Agreed. But this new feature is a bit confusing - there isn't anything dynamic in it. It's more or less a compile time rewrite rule. It becomes dynamic when all of that can be done on runtime and there are no templates involved.

Yes, that's done via old-school forwarding.

Andrei

Reply via email to