[E-Lang] down with `define' (was: newbie syntax: picayune points from a prejudiced programmer)
Marc Stiegler
marcs@skyhunter.com
Fri, 2 Mar 2001 01:29:30 -0700
> I feel like we are no longer asking the right question. I go back to
Zooko's
> observation that Python enables 2 different mental models of classes, one
> for beginners and one for pros. E's model-for-beginners has always been
just
> slightly too bent to be entirely satisfying, though my own personal
> experiences with it suggest it was (marginally) adequate. We seem to be
> asking the question, "how do we get rid of the bent model?", for which
there
> is an easy (and wrong, IMHO), answer. The important question is, "how do
we
> create a good model-for-beginners?" If we can get a good answer to this,
> then we can move across this process with a series of agreements.
Otherwise,
> we will move across it with a series of disagreements, some of them very
> serious indeed.
In response to my own attempt to propose a better question, I will now toss
out a couple of ideas for how to get a better answer. I suspect people will
say these ideas are bad ones, but if they stimulate someone to come up with
a better counter-proposal, they will have fulfilled their purpose.
Suppose we made the "class" keyword a synonym for "def"? Then the convention
could be
class Thing() :any {
def thing{}
}
def thing := Thing()
For inheritance (no, Tyler, I'm still not agreeing to just kill it dead :-),
could we use "subclass" as the keyword?
This does not actually help make the explanations in the book a lot simpler.
But it does supply a self-evident convention that will make code look more
familiar for beginners.
We could also make "new" the secret shortcut method instead of "run":
class Thing() :any {
def thing{}
}
def thing := Thing new()
This looks positively Java-esque. It kinda makes me smile :-)
"new" is of course not as general purpose as run...but if "new" didn't make
sense in the context of the usage, then, hey, use the shortcut convention,
that's what it's there for :-) Seriously, since the term we use as the
secret shortcut method is a one-shot-only bullet, and this is the most
important part of the language that still needs more bullets, it seems like
a sensible idea to me.
Also, using "new" as the shortcut would make the function/object part of the
book simpler, because the multiple constructors maker would be defining
multiple "new" methods rather than multiple "run" methods, which is more
intuitive inside that context.
--marcs