[Top] [All Lists]

Re: Sieve extensions

1998-01-18 18:33:40
Tim Showalter <tjs+(_at_)andrew(_dot_)cmu(_dot_)edu> writes:
A regular syntax means you can't add new constructs that don't look like
old constructs, you can only add things like "commands" and "expressions",
never "loops" or "variables" (unless you do something really bizarre).

  It's actually not hard at all, if you plan it in advance.  (Granted,
it limits what you can do in the future, but it's possible to make the
syntax general enough so that it won't be a problem).

Perl does not have a clean syntax.  It has a few lucky assumptions that let
the programmers and new features at will, and has been fairly extensible as
a result of that.

  The point was that perl 5's syntax is cleaner than perl 4's syntax;
the progression of the language has been to remove special-case syntax

Having a standard syntax for tests and actions would be very beneficial;
it'd certainly prevent future extensions from doing anything dumb
unnecessarily.  The point of contention isn't that a regular syntax is good
or bad -- it's good -- but rather that extensions can extend the regular
syntax, if it's called for.

  Okay - I flatly disagree.  I strongly feel that no extension should
ever mess with the syntax.  (To tie in with another thread, it'll be
*impossible* to write a generic middleman sieve storage mechanism
that'll validate a script and let the user know before it goes to the
MTA (or whatever) that their script has a syntactic-level problem,
something that shouldn't be required of the storage mechanism, but is
nevertheless *extremely* useful if the middleman is up to it).

There's one difference between any language you care to name and Sieve.
The basic question is if old parsers always be able to parse scripts with
extensions.  Perl 4 can't parse perl5's syntax extensions; it's just
handled by a little line of common syntax at the beginning of the script
telling the kernel which interpreter it wants to pipe stuff through --
"#!/usr/local/bin/perl5".  C can't parse C++, old LISPs can't parse
CommonLISP backquoting.

  I'm not quite sure what you mean, here - what's the difference
between any other language and Sieve?

  When you make a change to the syntactic structure of a language, you
lose backwards compatibility - it's effectively a new language.  If
the language's syntax is sufficiently flexible, though, you don't need
to change the syntax when you add an extension - the extension extends
the semantic meaning of the program, without changing the syntax.  Old
interpreters might not be able to interpret parts of a script, but
they'll be able to parse it, and maybe do something useful with what
they get.


<Prev in Thread] Current Thread [Next in Thread>