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

Re: pretty-lambdas

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.)