[E-Lang] get, set, and dot

Tyler Close tclose@oilspace.com
Tue, 27 Feb 2001 10:50:01 -0000


MarcS wrote:
> While I agree with the usage convention of using the
> 1-method shortcut only
> for Makers, I still think keeping the shortcut in the
> language is a good
> idea. The important thing it saves in Makers is a level of
> indentation,

So why not use the "function()" style for this. Why do you need a
specially named "new" method? This isn't class based programming.
Pretending that it is only deceives the reader about very important
architectural differences in the model of computation.

If you want to distinguish a function from a constructor, then I
suggest using a capital for the first letter of a constructor and a
lower-case for the first letter of a function.

> You mentioned a concern about overlapping syntactic sugars,
> how many others
> are out there in the darkness, waiting to surprise you?

It's hard to see in the darkness, especially when things are lurking.
I don't know how many sugars I've forgotten. I just know that I feel
like there are a lot of them and that each language release seems to
introduce new ones. I don't think I typically use much sugar,
suggesting that I've forgotten lots.

> There are 4
> syntactic sugars that leave me feeling like they can lead
> to surprises: the
> function() shortcut syntax, the Maker shortcut syntax, the
> dot notation, and
> the (shudder!) Visual Basic syntax.

There are 6 ways of creating objects documented at:

http://www.erights.org/elang/grammar/prim-expr.html#defineObj

Add to these the "delegate" sugar, the "_" for the "name" variants and
the sugars that MarkM added in

http://www.eros-os.org/pipermail/e-lang/2001-January/004123.html

The new sugar for anonymous objects looks wierd to me. Dropping the
"def" keyword really puts you "out there" without anything tangible to
latch onto. "What is this underscore just sitting there?"

Of all of these variants, I typically only use the "base" syntax and
the "function" sugar. (These are the second and first variants
documented at the given URL.) I think limiting "match" expressions to
a single "handler" method would be a good idea. No "delegate" sugar.

E also has a large number of operators (45?). I really like the use of
a small number of operators as sugar for method names, but I am sure E
has more operators than I can remember. I suspect that full use of all
of the operators could quickly make code descend into the arcane. I'll
make a shortlist if there's any hope of change here.

There are 3 ways to do a synchronous method invocation.

foo run()
foo run
foo ()

Plus the recently deceased "." sugar. I've tried using all of these,
but I think I'd be better off just sticking with "foo run()" all of
the time. If it's a commonly called method, then I've likely got an
operator that I'll be able to use instead (assuming MarkM does the
operator renaming I asked for, or some variant of it).

E is a very expressive language. There's a lot of stuff going on in
very little space. I think E has already won a decisive victory on
terseness. I think clarity and consistency are now more important.
Saving a few more characters at the cost of clarity is not a good
tradeoff at this point.

Tyler