(scheme r5rs)
library. I don't know how this idea came up, but the result was rather interesting.So I've prepared the following script;
(import (only (scheme base) error cond-expand include) (scheme process-context) (scheme r5rs)) (cond-expand (foment (include "\\cygwin\\tmp\\sclint09\\pexpr.scm" "\\cygwin\\tmp\\sclint09\\read.scm" "\\cygwin\\tmp\\sclint09\\environ.scm" "\\cygwin\\tmp\\sclint09\\special.scm" "\\cygwin\\tmp\\sclint09\\procs.scm" "\\cygwin\\tmp\\sclint09\\top-level.scm" "\\cygwin\\tmp\\sclint09\\checkarg.scm" "\\cygwin\\tmp\\sclint09\\sclint.scm" "\\cygwin\\tmp\\sclint09\\match.scm" "\\cygwin\\tmp\\sclint09\\indent.scm")) (else (include "/tmp/sclint09/pexpr.scm" "/tmp/sclint09/read.scm" "/tmp/sclint09/environ.scm" "/tmp/sclint09/special.scm" "/tmp/sclint09/procs.scm" "/tmp/sclint09/top-level.scm" "/tmp/sclint09/checkarg.scm" "/tmp/sclint09/sclint.scm" "/tmp/sclint09/match.scm" "/tmp/sclint09/indent.scm"))) (sclint (cdr (command-line)))The original article is using
load
but foment
complained that scling
is not defined. So above is
using include
instead (even though I've used include
yet Foment raised errors...). And execute it with 4 implementations, Chibi, Foment, Gauche and Sagittarius (both 0.5.8 and HEAD). The result was only Gauche could execute as I expected. Foment raised 2 errors (I don't know why), Chibi and Sagittarius raised an error with unbound variable else
.Apparently, the
(scheme r5rs)
library does't export 4 auxiliary syntaxes; =>
, else
, unquote
and unquote-splicing
; and one syntax (or macro transfomer) syntax-rules
. I believe the last one is just missing but the others are bit more complicated.The only purpose of (scheme r5rs) is to provide an easy way to import the identifiers defined by R5RS; it does not give you an R5RS emulator.I thought the purpose is making sure R5RS scripts can be executed on R7RS implementations but seems not. Then question is that if the 4 auxiliary syntaxes are bound in R5RS. If I see R5RS then indeed it doesn't define them explicitly, however this post indicates they are;
http://lists.scheme-reports.org/pipermail/scheme-reports/2014-October/004267.html
R5RS 3.1.I think this interpretation is rather rational so I've added those auxiliary syntaxes to export clause of
> An identifier that names a type of syntax is called
> a syntactic keyword and is said to be bound to that syntax.
R5RS 7.1.
> <syntactic keyword> -> <expression keyword>
> | else | => | define
> | unquote | unquote-splicing
"else" is syntactic keyword, and syntactic keyword is bound to syntax.
Therefore, "else" is bound.
http://lists.scheme-reports.org/pipermail/scheme-reports/2014-October/004265.html
(scheme r5rs)
. However, I can also think of the objection that could be something like this; being bound to a syntax doesn't mean they were bound in R5RS (or its environment).Well, I've already decided to add them so I don't have much option about this anymore but it would be convenient if legacy R5RS scripts can be executed on R7RS implementations with just importing
(scheme r5rs)
.
No comments:
Post a Comment