jastrachan | 18 Nov 08:39 2004
Picon

Re: Static dispatch and call semantics


On 17 Nov 2004, at 17:41, John Wilson wrote:

>
> On 17 Nov 2004, at 17:34, Robert Yokota wrote:
>
>> Now I'm really confused about "any".  Can one cast to "any"?  It 
>> certainly
>> wouldn't make sense to cast to "var" or "def", right?  Or would it?
>>
>
> Robert,
>
> That's one of the questions I'm asking :)
>
> As I understand it, 'any' is a sort of type.
>
> Object a = new Expando()
> any b = a
>
> a.f = {...} 	// fails at compile time
> b.f = {...}	// is OK
>
> the raises the question as to what
>
> println a.class
> println b.class
> println a.class === b.class

It doesn't change the type of the object, just the type of the name, 
just like in Java.

Object x = "foo"
String y = "foo"

assert x.class == y.class

James
-------
http://radio.weblogs.com/0112098/


Gmane