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

Re: [Scheme-reports] ANN: first draft of R7RS small language available

Hi again,

On Fri 29 Apr 2011 11:52, Andy Wingo <wingo@x> writes:

>> On Sun, Apr 17, 2011 at 2:09 AM, Andre van Tonder <andre@x> wrote:
>>> - There is a very strong argument for requiring these literals to be bound.
>>> If they refer to bindings, they can be exported, imported, prefixed, renamed,
>>> or excluded. These are useful operations, and I think it is important for
>>> users to be able to rely on them to work portably.
> FWIW I am convinced by Andre's arguments.  I can't change Guile right
> now, but will look at doing so for 2.2.  Relying on free-identifier=?
> for unbound identifiers is a source of ambient authority in a language.
> Perhaps I've been reading too much ocap stuff lately though; but binding
> keywords does seem to be a logical extension of lexical scope, which is
> what we're all here for, no?
> In any case, if R7RS does not decide to require that keywords be bound,
> it would be good if it permitted that behavior.  That might be tricky of
> course.

Since there is not enough traffic on this list I'll let my other
personalities argue the other side :-)

I just made a change in Guile to detect renamed keywords.  Previously if
a literal keyword were not lexically bound when the macro was defined,
it would simply check that the keyword was not lexically bound at the
use site, and that it had the same symbolic name.

This was an artifact of how an old version of psyntax worked.

I changed it to instead compare top-level bindings instead of names,
only falling back on names if neither was bound.

But then I got a bunch of errors, like this one:

     GUILEC ice-9/i18n.go
   ice-9/boot-9.scm:118:20: In procedure #<procedure 1b477d0 at ice-9/boot-9.scm:110:6 (thrown-k . args)>:
   ice-9/boot-9.scm:118:20: Syntax error:
   ice-9/i18n.scm:86:0: eval-when: invalid situation in subform eval of (eval-when (eval load compile) (load-extension (string-append "libguile-" (effective-version)) "scm_init_i18n"))

I'm not really sure what binding of eval it's looking for -- is it
looking for an unbound eval, or if it's looking for a binding, which
one? -- but that's largely immaterial.  Guile, in its toplevel
environment, provides eval, load, and compile, and also eval-when.  (I
know eval-when is a red flag for some folks, but it's not relevant to
this argument.)

The issue is that, if we treat literals as matching bindings and not
names, giving people the capability to eval-when something at
compile-time *also* requires giving them the `compile' procedure!

I don't know.  Like most of you, I've been programming scheme for a
while, but the implications of lexical scope on keywords and modules
have not even crossed my mind until an R6RS user reported a bug in our
R6RS implementation, to this effect.

I'll continue to mull this over, but it looks complicated!


Scheme-reports mailing list