Undefined values: Difference between revisions

Line 1,157:
=={{header|Smalltalk}}==
In Smalltalk, all variables are automatically initialized to nil. This includes instance variables (an object's private slots), class variables and locals. Also global and namespace bindings can only be created by passing an existing value (typically also: nil) to the creation message (at:put:). This is part of the language's specification, not implementation specific. Thus a variable cannot ever be undefined.
 
Sending a message (aka performing a virtual function call) to the nil object results in an Exception, which can be caught if desired.
In other words, there is no segmentation violation or core dump, but well defined behavior in this situation.
 
However, we can check for the existence of a global binding with:
Anonymous user