simple object model (was: [self-interest] selfing Self)
Steve Dekorte
steve at dekorte.com
Fri Mar 30 21:39:49 UTC 2001
On Friday, March 30, 2001, at 11:59 AM, Jecel Assumpcao Jr wrote:
>
>> So
>> now I'm in process of thinking out a more flexible but yet powerful
>> language. By now I have implemented two experimental versions of
>> Self. But I need something different.
>
> Me too, but more in the spirit of Self than the Self-inspired languages
> of the early 1990s.
>
>>> Like a simple object model: objects are just flat association lists
>>> (I'll use Lisp notation below) -
>>>
>>> (x 3 y 4)
>>
>> flat list has an array structure rather than linked list?
How about a hash table? NewtonScript, JavaScript, and Lua use simple hash
tables for "objects". An object becomes simply a hash table that holds
both data
and functions. For example:
Dog =
{
name = "fido",
bark = function (self) print("bark") end
}
To get inheritance add the simple rule:
if table lookup fails and table has a parent name/value pair then
perform the
lookup on the parent value.
Steve
More information about the Self-interest
mailing list