Squid language (was: Looking for tools for supportoftheoretical informatics research)

Anthony Hannan ajh18 at cornell.edu
Sat Jul 12 02:19:26 UTC 2003


The best thing I like about lambda-objects (Lisp) is that they can be
nested inside one another arbitrarily, providing namespaces and
encapsulation/security.  For example:

 Array _ [
	ObjectMemory _ here arg.
	[
		elements _ nil.
		instance _ [
			here dispatch: {
				#at: -> [ObjectMemory record: elements at: here arg].
				#at:put: -> [...].
				...
			}
		].
		here dispatch: {
			#new: -> [
				elements := ObjectMemory allocate: here arg.
				instance
			]
		}
	]
 ].

 [
	ObjectMemory _ [
		collectGarbage _ [...].
		[
			here dispatch: {
				#allocate: -> [
					...
					collectGarbage value.
					...
				].
				#record:at: -> [...].
				...
			}
		]
	] value.
	Array := Array value: ObjectMemory.
 ] value.

Array "imports" ObjectMemory without ObjectMemory being available to
anyone else.  Also, collectGarbage in ObjectMemory is private to
ObjectMemory; sender can't invoke it.

Cheers,
Anthony



More information about the Squeak-dev mailing list