[Larceny-users] define-record-type fields' procedures' identifiers lose their lexical context

Derick Eddington derick.eddington at gmail.com
Sun Apr 5 22:42:36 EDT 2009


`foo' is macro-introduced (which means the exception for the last
expression below is correct) but the other identifiers are not, so they
should retain their original lexical context, which means the exceptions
for the `foo-x' and `foo-x-set!' expressions below are incorrect because
those identifiers should be bound.


Larceny v0.97a4 (alpha test) (Mar 28 2009 23:47:58, precise:Linux:unified)
larceny.heap, built on Sat Mar 28 23:49:25 PDT 2009
ERR5RS mode (no libraries have been imported)

> (import (rnrs))
Autoloading (rnrs)
Autoloading (rnrs enums)
Autoloading (rnrs lists)
Autoloading (rnrs syntax-case)
Autoloading (rnrs conditions)
Autoloading (err5rs records procedural)
Autoloading (rnrs exceptions)
Autoloading (rnrs hashtables)
Autoloading (rnrs arithmetic bitwise)
Autoloading (rnrs programs)
Autoloading (rnrs files)
Autoloading (rnrs io ports)
Autoloading (larceny deprecated)
Autoloading (rnrs records syntactic)
Autoloading (rnrs records procedural)
Autoloading (rnrs control)
Autoloading (rnrs sorting)
Autoloading (rnrs bytevectors)
Autoloading (rnrs unicode)

> (define-syntax def-foo
    (syntax-rules ()
      ((_ make pred (field accessor setter) ...)
       (define-record-type (foo make pred)
         (fields (mutable field accessor setter) ...)))))

> (def-foo make-foo foo? (x foo-x foo-x-set!))

> foo-x


Error: Undefined global variable "foo-x".
Entering debugger; type "?" for help.
debug> q

> foo-x-set!


Error: Undefined global variable "foo-x-set!".
Entering debugger; type "?" for help.
debug> q

> make-foo
#<PROCEDURE>

> foo?
#<PROCEDURE condition?>

> foo


Error: Undefined global variable "foo".
Entering debugger; type "?" for help.
debug> q

> 





More information about the Larceny-users mailing list