Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Scheme is undefined shit

Name: Anonymous 2016-05-02 19:38

The behavior of syntax-rules -- in particular, the renaming of identifiers that will appear at the top level -- is not completely specified in R5RS. Different implementations of macro-expanders vary widely in this respect.

The following is an illustrative test. It is a syntax-rule for letrec (taken verbatim from Section 7.3 of R5RS) with only one change: the fragment

(let ((var1 <undefined>) ...)
(let ((temp1 init1) ...)
(set! var1 temp1)
...
body ...)


is replaced by the "equivalent" code:

(begin
(define var1 #f) ...
(define temp1 init1) ...
(set! var1 temp1) ...
body ...))


We also changed the name to letrec1 to avoid confusion with the standard letrec. If we use letrec1 at the top level and overlook the pollution of the global namespace, we may expect that letrec1 is semantically equivalent to letrec.

Is it? To test this claim, we evaluate the following expression:

(letrec1 ((x 1) (y 2)) (display (+ x y)) (newline))

It turns out, this expression may print 3, print 4, or raise an unbound variable error. You might wish to load the file referenced below into your Scheme system. The existing Scheme systems almost evenly fall into three categories regarding this test.

Result 3 is printed by:
Scheme48, Chez Scheme, MIT Scheme 7.7.1, Chicken

Result 4 is printed by:
PLT Scheme 202, SCM (native macro-expander), Gauche Scheme, Gambit (with Hieb and Dybvig implementation of syntax-rules/syntax-case), Al Petrofsky's portable macro-expander

Unbound variable error is raised by:
SCM with Will Clinger's expander (aka Macros that work), Petite Chez Scheme 6.0a, Bigloo 2.4b

http://okmij.org/ftp/Scheme/macros.html#Macro-CPS-programming

Name: Anonymous 2016-05-03 10:28

>>2
Because speed often has no bearing on whether or not a language is shit? It's like Cudder complaining about bloat.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List