jastrachan | 7 Jul 16:21 2004

Re: [groovy-dev] static binding subsystem for better performance

On 7 Jul 2004, at 15:15, John Wilson wrote:
> On 7 Jul 2004, at 14:37, jastrachan@... wrote:
>> One minor thought...
>> [snip]
>> In static typing mode we should be checking the methods are correct 
>> at compile time & giving a nice error if they're not - this is one of 
>> the main aims of static typing afterall. (Whether we're in static 
>> typing or dynamic typing, the compiler/runtime can get clever & do 
>> static method dispatch but I consider that an optimisation).  So if 
>> you declare a variable to be of type Object and then call some method 
>> foo() it should probably barf & fail to compile rather than quietly 
>> going into dynamic typing mode.
>> Maybe we should use a magic type name of 'any' to indicate that you 
>> definitely want to be dynamically typed?
> Doesn't the non magic type name Object do that already?

It shouldn't, as Object is a valid statically typed type. Sometimes I 
want an object of type Object and to use static method dispatch on it. 
e.g. when using an object as a lock & calling its wait() / notify()