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

Non-upward-compatibility of Chez Scheme versions



`define-macro!', the form used to define macros in older versions of 
Chez Scheme [TM, Cadence Research Systems] is also provided in the current 
version (along with the fancier `extend-syntax'/`with'). However, the older 
version (v.1.1, 1985) seems more powerful (expressive) than the current one 
(v.2.0.3, 1987)!

In the old case, it is possible to specify not just text but closures in
a "macro"'s expansion pattern. For example, the following almost pointless
program,

	(let ([null? null?])
	  (define-macro! nil? (x)
	    `(,null? ,x))		; note comma before null?

works fine in v.1.1, `nil?' being a macro version of `null?'. As motivation
for using the closure `null?' rather than the variable `null?' in the above
macro expansion, one might consider that the global variable `null?' can now 
be redefined to something else, but `nil?' will always test for nil-ness.

This ruse doesn't work in v.2.0.3:
	The program (nil? 7) yields the diagnostic:
	Error: nonsensical application (#<procedure null?> 7).

Anyone know why Cadence (Dybvig?) thought fit to do away with the old
Chez's more powerful macros? {I don't know Cadence's e-mail address.}

--dorai

ps: It might be argued that there might be newer ways (possibly using `extend-
    syntax'/`with') to get the effect described above, if not with the same 
    program fragment. Nope. There just doesn't seem a way to get closures in 
    the expansion pattern in new Chez.