Re: cast to a particular type

Francis Barber <[email protected]> Thu, 6 May 2004 14:29:20 +1000 (EST)
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
Hello All,

I don't really understand why we need to do a cast in
the first place.  Surely the right method can be
determined based upon the run-time type of the object.

Cheers,
Frank.

>
> No. In your example you could also declare x with
> the desired type 
> instead of Object, and use cast.
> 
> As proposed before, an additional feature could be
> implemented: allowing 
> 'assert x instanceof A' statements to be taken into
> account by the 
> typechecker. Tests like 'if (x instanceof A)' are
> already handled.
> 
> In general, casts should be be exceptional, so
> making them shorter is 
> rather a non-goal...
> 
> Cheers,
> 
> Daniel


Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3