Squeak


Implementation and Squeak27 Jul 2006 08:34 pm

Back in 2000, I got a chance to demo an environment based on the Morphtron derived FreeDOM architecture at Squeakend 2000. John McIntosh really captured the key ideas. One was

The thought is that the web will become a distributed object oriented space. Then the question is how to interact with it, and how to navigate and how it’s displayed. Squeak gives wonderful control over that, we must exploit that.
Squeakend 2000

At that time the outliner was often in the spotlight and the code base was not as flexible or modular as it is today. Here’s a screenshot from that era:

Morphic Joules

There’s been a lot of evolution since then - the outliner has taken its place in a larger 3D world but the core concepts have remained the same.

MOPA and MPF and Smalltalk and Squeak27 Jul 2006 09:50 am

This simple example included in the beta image is shown below with comments and italicized results.

create a new object
o_Object new. an Object

see if it has a ‘hello world’ property
o fetchProperty: ‘hello world’. nil
put something into the hello world property
o putIntoProperty: {’hello world’. ‘first program’}

fetch the new property
o fetchProperty: ‘hello world’. ‘first program’

when you fetch all of an object’s properties, you get all the methods and instance variables along with the accessories
o fetchProperties a Dictionary(size 453)

this simple object has only one accessory
o fetchAccessories a Dictionary(’hello world’->’first program’ )
o fetchAccessory: ‘hello world’ ‘first program’

There are methods such as hasProperty and hasAccessory and other variants(hasNativeExecutableProperty) that allow you to determine what the properties an object has are.

Implementation and Squeak27 Jul 2006 09:34 am

Squeak 3.8 based image and changes files are available in a zip file. I’m still wrangling about what formats support - there’s no simple answer right now. It may end up both change sets and Monticello packages in Subversion which will be the common repository for other language implementations. Spoon can’t arrive too soon!

Dolphin and Implementation and Javascript and MOPA and MPF and Mozilla and Smalltalk and Squeak and Yahoo Widgets(Konfabulator)25 Jul 2006 11:13 pm

A full implementation of Morphtron provides a common, transparent means of providing access to properties by using the native property if it exists. In cases where no native property exists, MOPA methods then use or optionally create an accessory. For example consider this Smalltalk(Squeak and Dolphin) implementation of fetchProperty:

fetchProperty: aSymbol
| property |
property _ self fetchNativeProperty: aSymbol.
property
ifNotNil: [^ property].
^ self fetchAccessory: aSymbol

The details of fetchNativeProperty are left up to the implementor. She can determine what access to native properties will be allowed. The following Smalltalk implementation this:

fetchNativeProperty: aSymbol
| ivarValue |
(self class allInstVarNames includes: aSymbol)
ifTrue: [”aSymbol is an ivar”
(self isPrivateInstVar: aSymbol)
ifFalse: [”aSymbol has not been declared private”
(self class lookupSelector: aSymbol) isNil
ifTrue: [self allowInstanceVariablePropertiesWithoutAccessors
ifTrue: [ivarValue _ Compiler
evaluate: ‘^’ , aSymbol asString
for: self
logged: false]]
ifFalse: [ivarValue _ self perform: aSymbol]]].
^ ivarValue

Now for a prototype-based language such as Javascript, things are simplified because all properties are native:

function fetchProperty(aName) {

/*

Using fetchProperty for accessing properties has a number of different benefits. It is easier for beginner-to-intermediate programmers and allows Morphtron behaviors to be ported between different object environments. It also lets accessories be used transparently as properties. That said, a programmer with sufficient knowledge can still use built-in properties and accessories however she wants. See also fetchAccessory. One interesting use of accessories is for undo.

*/

var theProperty=this[aName];

if(typeof(theProperty)==’undefined’) {

theProperty=this.fetchAccessory(aName);

}

return(theProperty);

}