[plt-scheme] Re: sxml.ss - Works on its own, but not in module

From: John Clements (clements at brinckerhoff.org)
Date: Wed Jan 16 15:36:38 EST 2008

On Jan 16, 2008, at 12:22 PM, Eli Barzilay wrote:

> On Jan 16, John Clements wrote:
>>
>> On Jan 16, 2008, at 12:52 AM, Dmitry Lizorkin wrote:
>>
>>> Hello John
>>>
>>>> it's also sort of a problem with the sxml package, AFAICT.
>>>
>>> I agree with you completely.
>>>
>>>> Would it be possible to fix the package so that this is no longer
>>>> an issue?
>>>
>>> I would be willing to fix this; however, I need your hint on how to
>>> handle such an eval-inside-a-package-issue in PLT module system.
>>
>> I believe that the canonical answer is: this use of eval is
>> untenable in PLT Scheme.  In particular, I observe that in PLT v4
>> (more specifically, 3.99.0.9) that I cannot compile your "foo.ss"
>> file, because I get an error that bar:f is unbound, which is pretty
>> much what I'd expect.  I'm willing to believe that this code works
>> differently in version 371.
>
> FWIW, 3.99 allows using eval in a much saner way (IMO):
>
> bar:
>  #lang scheme/base
>  (define (bar:f) 1)
>  (define-namespace-anchor bar-world)
>  (define (bar:g) (eval '(bar:f) (namespace-anchor->namespace bar- 
> world)))
>  (provide (all-defined-out))
>
> foo:
>  #lang scheme/base
>  (require "bar.ss")
>  (define test (bar:g))
>  (provide test)
>
> repl:
>  Welcome to MzScheme v3.99.0.9 [3m], Copyright (c) 2004-2008 PLT  
> Scheme Inc.
>> (require "foo.ss")
>> test
>  1

Nice!  See, I knew that forwarding it to plt-scheme would be a good  
idea.

John



Posted on the users mailing list.