[E-Lang] down with `define' (was: newbie syntax: picayune points from a prejudiced programmer)

Mark S. Miller markm@caplet.com
Thu, 01 Mar 2001 21:35:32 -0800


At 11:24 AM Thursday 3/1/01, Ka-Ping Yee wrote:
>On Thu, 1 Mar 2001 zooko@zooko.com wrote:
>>  MarkM wrote:
>> > Anyone want to speak up to save "define"?  Speak now or forever...
>> Cool!  I'm pleased that you are considering dropping it.
>Wow, cool.  I've been wanting to drop "define" in the bit bucket
>for a while.  (I also have similar feelings on the use of
>parentheses for function calls.)
[And many other comments from many people on the list]

Considering?  Of course!  As Bartley says (approximately), rationality 
consists of holding all beliefs tentatively (including this notion of 
rationality), and always being willing to drop an old belief when faced with 
good enough arguments to the contrary.  Of course, in engineering we can't 
quite live up to this and ship in finite time, but an open source process 
can both have and eat more of this cake than normally thought possible.

The e-lang list is an exemplary example of why the open source process 
works.  The criticisms from y'all have made E much better than a lone auteur http://www.cinemazine.com/engels/archief/kael/eng1.html (or at least I, 
acting in auteur mode) ever could have made it.  Or, as John Henson of 
openCOLA says, "We don't want to be wrong.  It's *great* to be corrected!"

Thank you all for the feedback.  In light of your reactions, here's what I 
tentatively propose to do to the grammar.  Further arguments of course are 
more than welcome.  But first, of course, some terminology.

* When something goes into the "pocket" (named after Tyler's pocket 
suggestion), this means we keep the option of turning this feature back on 
in the future, and we allow it to be turned on with a switch for 
experimental purposes, and to ease the transition -- to prevent old code 
from breaking immediately.

* When something is "deprecated", then it can still temporarily be turned 
back on by a switch during transitional releases, but not afterwards.  

Something that's deprecated dies unless it's rescued quickly.  Something in 
the pocket eventually dies if it remains in the pocket long enough with no 
expressed interest.  In both cases, the official E grammar as of a given 
release consists only of the syntax accepted when none of these switches are 
turned on.  Therefore, independent implementations of E are free to ignore 
the deprecated and in-pocket features.



1) VBish syntax is gone.  Not even in the pocket or deprecated.  No switch 
turns it back on.

2) The dot syntax for JavaBeans properties (get/set methods) goes in the 
pocket.

3) The "define" synonym for "def" is deprecated.  As a keyword, once it is 
no longer even deprecated, it will move to the reserved keywords list.

4) I find the "command-line completion argument" for parens compelling.  
Therefore, the no-paren invocation goes in the pocket, both on invocation 
and on definition.  We should start thinking about concrete command line 
completion rules, and a concrete algorithm for implementing these rules.  
But I don't think there's any hurry to actually implement these.

5) I don't think command line completion can provide the Java-like 
invocation dot.  Therefore, and because #2 remains in the pocket, and also
because the invocation dot simply makes my eyeballs hurt, E continues to use 
whitespace rather than dot for invocation.  No change on this one.

6) The "delegate" shorthand for a matcher goes in the pocket.


7) Of the many shorthands for an object expression, the following remain in 
the language:


a) The explicit vTable with zero or more matchers:

    def name { method* matcher* }

b) The function shorthand:

    def name(...) :any { ... }

c) The thunk shorthand:

    _{ ... }


and the following go into the pocket:


d) The single method object definition, eg,

    def FooMaker new(...) :any { ... }

e) Anonymous object definition that leaves off the "def" while keeping the 
function signature, eg,

    _(...) :any { ... }

f) The plumbing expression (it was always flagged as experimental anyway):

    def name match pattern { ... }

g) The class shorthand, for supporting inheritance:

    class name(...) :any { ... }

If the dreaded political issue raises its ugly head, we can quickly pull 
inheritance back out of the pocket.


But note that #7f (the plumbing expression) isn't a shorthand.  It's part 
of Kernel-E.  #7f proposes to put this part of Kernel-E in the pocket.  

Speaking of Kernel-E changes:


8) Kill (not pocket or deprecate) the "loop" syntaxes, and therefore the 
Kernel-E loop construct.  Instead, put a primitive one-argument function 
named "loop" in the universalScope, where this function takes a 
zero-argument function (a thunk) as argument and just repeatedly invokes it 
forever.  In order words, what would have been written:

    loop { ... }

would now be written

    loop( _{ ... })

The main reason for this isn't syntax reduction, but (as Danfuzz advocated 
when he suggested it) to make automated analysis of Kernel-E easier.  Why?  
Because now variables would only be newly instantiated on entry to a method 
or a matcher.  Period.  This should make it easier to write a simple 
compiler, and no harder to write a high-ambition compiler.  (Though it does 
make it harder to write a medium ambition compiler.)


Other than #7f and #8, all the rest are changes only to the syntactic 
shorthands available, not changes to any other aspect of the language.


Waddaya think?


        Cheers,
        --MarkM