Saving morphs to file

Andreas Raab andreas.raab at gmx.de
Tue Jul 18 17:08:38 UTC 2006


stéphane ducasse wrote:
> On 18 juil. 06, at 07:33, Andreas Raab wrote:
>> Yes. Alternatively, if we had a "literal object/class" syntax this 
>> would be very simple, too.
> 
> could you explain what you mean by literal object/class

Simply put, instead of defining a heavy-weight class (like we have right 
now), you have syntactic support for an inline object definition, making 
it possible to do something like here:

   sorted := def SortedCollection [
     sorts: a before: b [
	^ a < b
     ]
   ]

The idea is that the we "def"ine an object (which also has an associated 
class anonymously derived from SortedCollection but that is besides the 
point here) and can override some methods right at this point. The main 
advantage is that the above makes class creation very light-weight, 
almost unnoticable (really only as the byproduct of creating an object 
with specialized behavior) which is very different from the current 
heavy-weight use of classes (requiring multiple context switches, names 
for the classes etc).

This of course gets more interesting when you need more than single 
parametrized method but the above illustrates the basic idea.

Cheers,
   - Andreas




More information about the Squeak-dev mailing list