Category:Smalltalk: Difference between revisions

Line 169:
 
=== Class Definition ===
Class definitionsClasses are not donedefined by syntactic constructs, but by sending a message to some class (to create a subclass), a metaclass (to create an instance) or to a namespace (to create a class and install it). The details vary slightly among dialects, but usually wrappers/forwarders are provided or easily adddadded if code is to be ported and any is missing in the target system.
<lang smalltalk>
someClass
Line 178:
category: 'for documentation only'.
</lang>
Classes can be anonymous, in most systems, you can "Class new new" to create a new anonymous class and an instance of it (but be aware, that the class should contain enough state to properly specify their instances layout, so usually more info is needed (number and names of instance variables, inheritance etc.)
 
=== Control Structures ===
Anonymous user