cast operation in Squeak

Julian Fitzell julian at beta4.com
Tue Mar 2 17:58:48 UTC 2004


Casting is a workaround for the problems of static typing.  Smalltalk 
(and thus Squeak) is dynamically typed and therefore doesn't need 
casting.  What exactly are you trying to accomplish?

Variables aren't typed, so you don't need casts for that.  And if the 
object behaves like a string, then you just call string methods on it. 
If it doesn't, you'd have to implement those methods just the same as 
you would in Java.

Perhaps you could post a code snippet?

Julian

Kwiyi Woo wrote:
> Hi,
> I want to cast a object to a certain class. How can I do cast operation 
> in Squeak as in other programming language? For example, I can do 
> something like in java:
> 
> String i = (String)str;
> 
> I couldn't figure out the syntac for it.
> 
> Thanks
> Kwiyi
> 
> _________________________________________________________________
> Say “good-bye” to spam, viruses and pop-ups with MSN Premium -- free 
> trial offer! http://click.atdmt.com/AVE/go/onm00200359ave/direct/01/
> 
> 



More information about the Squeak-dev mailing list