[E-Lang] newbie syntax: picayune points from a prejudiced programmer

zooko@zooko.com zooko@zooko.com
Sat, 03 Mar 2001 12:29:15 -0800


I think I am pickier than most programmers about whitespace.

For example, I've gotten into arguments on many occasions with
different co-hackers on the question of whitespace in conditionals.  
I hate to see:

>>> if(something) ...
>>> spam(something)

or 

>>> if (something) ...
>>> spam (something)

I much prefer 

>>> if (something) ...
>>> 
>>> spam(something)

or even better (after a cohacker of mine persuaded me by agreeing to
adopt *my* style on another issue):

>>> if something ...
>>> 
>>> spam(something)

For a long time I actually used an Emacs lisp script that I wrote to
automatically find all Java keywords in the current file and make sure
they have a space after them, and find all functions and make sure they
don't have a space after them.


In short, I want keywords and functions to be as visibly different as
possible.

(This is the thing that I dislike about Scheme syntax, BTW -- the way
that special forms, functions, sequences of expressions, and data
structures all look alike.)


This makes me dislike E's required parens around conditional
expressions and E's "whitespace as the `.' operator".

[Note: this is because I am still in newbie mode.  The real Zooko would
try writing some E first and then decide if he preferred " " to ".".
But a picky newbie wouldn't.]


Regards,

PPooko

P.S.  I wouldn't suggest that E should enforce my style prejudices.
For example I wouldn't suggest that it forbid unnecessary parens around
conditional expressions -- that would obviously turn off those
programmers whose preference is the opposite of mine!  But by the same
token, E should not *require* parens around conditional expressions
unless there would be some compelling negative consequences of doing
otherwise.  (Where mere style issues are not compelling to me as 
I would rather have ten million E coders writing in ugly style than 100
E coders writing in beautiful style.)

P.P.S.  A word on style: when Java was launched it came with an
official consistent style, modelled on good old fashioned K&E style.
Even though the language doesn't enforce it, the presence of an
official style in all the docs and examples led to widespread
consensus, putting an end to style wars.  Co-hackers who had bickered
endlessly with one another about C and C++ style put aside their
differences and adopted the new standard with almost no complaint.
They (we) sensed, I think, that common style was the best value to be
had, and that the details of the common style were a fait accompli.

So IMHO the docs and examples and perhaps some standard lintian tool
are the right way to ensure common style, and the language itself is
the wrong way.

But you probably already knew all this.  :-)

I won't be surprised to learn that parens are required around
conditional expressions in E because of some unavoidable deeper issue,
rather than because someone preferred the look of more parens.

P.P.P.S.  Okay Java didn't *quite* put an end to style wars.  At
Chinese dinner during the O'Reilly p2p conference I was caught in the
crossfire of a couple of co-developers, it seemed, were refusing to use
one another's code because one of them insisted on putting "{" on a new
line by itself...  ;-)