thing human legs 2 thing Socrates is-a {human philosopher}Note that philosopher is a not-yet defined name here, it's just a string, and strings are implicitly also things. Thus, if everything is a string and a string is a thing, then everything is a thing. QED. (But seriously, strings can for instance not necessarily be used as command names, so let's better distinguish little things like strings and real things, of which this page deals).A little thing can always be raised to a real thing - by calling it "thing". So much for forward references...Things have properties (variables, facets, ...) that can be set and got in the familiar way:
human set mortal 1 ;# Humans are mortal Socrates set hair white Socrates set hair ;# returns ==>: whiteAccording to the is-a list (a property things always have, and be it the empty list), properties are searched in "superthings" if not found in the thing itself:
Socrates set mortal ;# ==> 1Properties can be introspected (more orthogonally than set/info vars):
Socrates set ;# ==> is-a mortal legsThings can have ways (methods, demons, ...) that can be set and got in an even more orthogonal way (pure Lambda) than proc/info args/info body provide, and inherited like properties:
human wayto sing {{text} {puts "$text, lala."}} Socrates wayto sing ;# ==> {{text} {puts "$text, lala."}} thing Plato Plato wayto sing [Socrates wayto sing] ;# knows how to sing, but isn't human Socrates wayto ;# ==> singand called like objects like to be called:
Socrates sing "Lali" ;# ==> Lali, lala.Special ways could be specified that get fired when a property is changed (write traces):
Socrates way-if-set legs {{} { puts "Hey, I now have [self get legs] legs!" }And good old introspection is always there:
Socrates help ;#(error) help? use one of: set, unset, is-a, sing, ... thing -names ;#==> human Socrates PlatoThat's what I have so far. Thoughts?
Andreas Kupries: Not so much as thoughts, but a couple of associations. IOW, the above reminds me of
- "prototype"-based OO systems [1], for example "SELF"
- Artificial intelligence (Artificial Intelligence with Tcl) and semantic nets, also case based reasoning. I once read the following book which had a chapter about this [2] (Actually it was a german translation).