[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Language simplicity

Subject: Re: [Haskell-cafe] Language simplicity
From: Steve Schafer
Date: Thu, 14 Jan 2010 09:53:33 -0500
On Thu, 14 Jan 2010 14:42:06 +0000, you wrote:

>> All Lisps have "special forms" which are evaluated uniquely and differently 
>> from function application and are therefore reserved words by another name. 
>> For example, Clojure has def, if, do, let, var, quote, fn, loop, recur, 
>> throw, try, monitor-enter, monitor-exit, dot, new and set!.
>Yes, but the special forms are not distinguishable from user defined
>macros --- and some Lisp-implemantations special forms are another
>implementations macros.  E.g. you can choose to make `if' a macro that
>expands to `cond' or vice versa.  I do not know whether you are
>allowed to shadow the name of special-forms.

You can in Scheme; syntactic-keyword bindings can shadow variable
bindings, and vice versa:

The following is given as an example in R5RS:

 (let-syntax ((when (syntax-rules ()
                      ((when test stmt1 stmt2 ...)
                       (if test
                           (begin stmt1
                                  stmt2 ...))))))

   (let ((if #t))
     (when if (set! if 'now))

Evaluating the above returns "now."

Steve Schafer
Fenestra Technologies Corp.
Haskell-Cafe mailing list
[email protected]

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