[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pretty-lambdas




--Sundar Narasimhan wrote:
>    At 9:46 AM -0500 12/4/02, Sundar Narasimhan wrote:
>    >      ^ (x y) (+ x y)
>    >So now I wonder idly.. how many other languages can do something like
>    >this (given this discussion started out re. macros after all :) --
>    >i.e. modify the base syntax for introducing something so basic.
>    >
>    >Python, Perl, Ruby, Smalltalk? Perhaps?
>    >
> 
>    I don't know how many languages let you modify the syntax
>    at the level of the lexer.
> 
>    I'm not convinced that this is actually a good idea, as it
>    happens, but it is undeniably useful to be able to define
>    a special "read table" for reading custom data files.  One
>    could reasonably argue that this is properly the domain of
>    lexing and parsing libraries, without having to argue as well
>    that macros are a poor idea.
> 
>    Common Lisp also has these things called "symbol macros"
>    where a random symbol in any old position can be magically
>    macro-expanded.  I'm pretty sure this is a bad idea.  The
>    problem with both of these things is that they can cause
>    the "deep" syntax of the language to silently change with
>    no cue to the reader that something magic is happening.
>    This is not quite as true of ordinary Lisp macros.  (I
>    say "not quite" because ordinary macros quite often change
>    evaluation semantics.)
> 

We used symbol-macros in RTML, the scripting language we 
wrote (very thinly) on top of CL for Viaweb.  It's one of those
things you need about once every five years, but if you don't
have it, you're fucked.

> Actually -- I tend to shy away from "good" vs. "bad" judgements when
> such facilities are concerned since these, in my mind at least, are  
> in the gray area of "trade-offs". 

Good thing you don't have to design programming languages.  A
language designer actually has to decide whether each potential
feature is good or bad, in order to decide whether to put it
into the language or not.

> 
> Just because programmers design languages does NOT mean that the
> syntax should necessarily be governed by them. I'll illustrate what I
> mean with a slight digression.
> 

Depends if you're designing an LFM or LFSP.  If you're designing
an LFSP, you have to keep remembering to slap yourself each
time you find yourself thinking, "I'd better not let programmers
do x."

--pg