Adam D. Ruppe Wrote:

> This seems to be to be nothing more than applying the same
> idea behind objects and interfaces to other types... if all
> variables were typed Object and you had:
> 
> interface Int {}
> interface String {}
> 
> void whatever(Int lineno, String rawdata) {}
> 
> it'd be the same thing, would it not?

In their language (here adapted to D syntax) this compiles with no errors, and 
it gives an error at runtime in the first line of foo, because the dynamic type 
of x is string, and it's not like an int:

int foo(like int y) { return y + 1; }
void main() {
    dyn x = "bar";
    foo(x);
}

Is this the same thing you are saying?

Bye,
bearophile

Reply via email to