[IAEP] Turtles All The Way Down
C. Scott Ananian
cscott at laptop.org
Tue May 24 13:11:29 EDT 2011
On Fri, May 20, 2011 at 11:09 AM, Alan Kay <alan.nemo at yahoo.com> wrote:
> Smalltalk actually got started by thinking about a way to make a child's
> Logo-like language with objects and pattern matching that could express its
> own operating system and environment.
>
> It is very tricky to retain/maintain readability (so the first Smalltalk was
> also an extensible language not just semantically but syntactically).
>
> With a tile language, this is really worth thinking about, since using tiles
> suggests ways to extend both the form and the meaning of the tiles.
I've written a follow-up post, musing on the "readability" aspect Alan
mentioned above:
http://cananian.livejournal.com/64330.html
Is it worth trading a very simple and direct syntax like:
var Point = {};
Point.x = 0;
Point.y = 0;
var Point3D = Object.create(Point);
Point3D.z = 0;
for the more readable:
Class("Point", {
has: {
x: {is: "ro"},
y: {is: "rw"},
},
})
Class("Point.ThreeD", {
isa: Point,
has: {
z: {}
},
})
at the cost of introducing additional complexity into the object
creation process. The complexity is in a library, so the base
language is kept small -- but it's still more turtles thrown onto the
stack that you have to understand.
Returning to Alan's point about tiles -- the nice thing is that you
could define a custom tile for the Class(....) syntax above, with
pretty selectors to help you select parent class, slot attributes,
etc. But perhaps it's better just to keep the conceptual model small
-- then you don't need fancy GUI widgets to help you out.
For a more concrete example, you might want to read through:
https://github.com/cscott/TurtleScript/blob/beeba5c138d88af40297f93689ecbe7721724819/crender.js#L333
starting at line 333 or so. That's a widget library written in
Simplified JavaScript/TurtleScript which uses prototype inheritance
extensively. You can do clever things like swipe the implementation
of a function from a totally different class; see how we do "multiple
inheritance" around line 661. Is the Joose syntax an improvement?
--scott
--
( http://cscott.net )
More information about the Devel
mailing list