[Newbies] Newbie: Error Checking in Dynamically typed Language
aditya_siram at hotmail.com
Sun Dec 10 03:22:09 UTC 2006
This is my first time working with a dynamically typed environment and my
first instinct is to error check all arguments. For example suppose I want
to create an object to represent an octet in an IP address (a number between
0 and 256) I would do something like this:
Object subclass: #Octet
octetValue := 0.
octetValue = numBtw0And256 <-------Here's where I have a problem
How do I know the numBtw0And256 is actually an integer between 0 and 256 and
not 'cat' or '3.14'?
Since I came from statically typed languages I feel like I writing a whole
bunch of error checking code along the lines of ifIsInteger: ... etc which
doesn't seem to be in the spirit of Squeak.
What am I doing wrong?
WIN up to $10,000 in cash or prizes enter the Microsoft Office Live
More information about the Beginners