[e-lang] Unary Prefix Now Composes with Unary Postfix

Mark S. Miller e-lang@mail.eros-os.org
Sat, 15 Jun 2002 23:40:14 -0700


Another draft note of a resolution for the next release:

                    Unary Prefix Now Composes with Unary Postfix

In the C syntax tradition, unary prefix operators and unary postfix 
operators can be used in the same expression, with unary postfix binding 
tighter than unary prefix. In prior releases of E, we took a more 
restrictive policy because 1) the standard rule is hard to remember, and 
worse 2) when we used juxtaposition for call, which is a unary postfix 
operation, it was visually counterintuitive for calls to bind tighter than 
unary prefix operators.

Now that we've switched to the conventional dot-call syntax, objection #2 has 
gone away. Though objection #1 is still valid, we've now decided to go with 
tradition on this one. Between this and the previous two changes (Dot-based 
Call, Dot-based Property Access), Ping's Python example 
http://www.eros-os.org/pipermail/e-lang/2002-June/006704.html :

    if guard.name not in frozenGuardNames:

can now be written in E as: 

    if (! frozenGuardNames.contains(guard.name)) {

assuming that guard has a getName() method. While this is still visually 
more noisy than the Python original, it's not too bad, and it can be 
instantly understood by someone coming from C syntax tradition languages 
(modulo the difference between properties and instance variables). 


----------------------------------------
Text by me above is hereby placed in the public domain

        Cheers,
        --MarkM