[racket-dev] Should BSL signal an error on (require ...) in an unsaved buffer?

From: John Clements (clements at brinckerhoff.org)
Date: Mon Jun 27 20:19:19 EDT 2011

On Jun 27, 2011, at 5:10 PM, Robby Findler wrote:

> On Tue, Jun 28, 2011 at 7:52 AM, John Clements
> <clements at brinckerhoff.org> wrote:
>> 
>> On Jun 27, 2011, at 4:45 PM, Robby Findler wrote:
>> 
>>> We're talking about relative requires only, right?
>>> 
>>> How are you proposing to signal the error?
>> 
>> My guess about how this works--correct me if I'm wrong--is that for unsaved buffers, DrR sets a parameter such that the expanded code has the current directory as (uh, part of?) the syntax-source of the expanded source.  I'm guessing that I'm not right, or it would be as simple as disabling this for programs written in BSL et al.
> 
> DrRacket does indeed set current-directory and could instead signal an
> error instead of setting it. That would mean no unsaved file would
> run, however. Is that really desired?

Would it not be possible to set the syntax-source in such a way that relative requires would fail? We may be out of DrR and into just plain R here.  

Indeed, I would be happy if buffers without a recorded save location couldn't make relative requires in *any* language level, though I realize that such a change would be more likely to have repercussions elsewhere.

I suppose there could be situations where users dynamically create syntax objects and set the current directory rather than setting the syntax-source of the objects, though that doesn't sound like the most robust way to write the code.

> 
> Also, this would not work for the #lang htdp/bsl versions of the
> teaching languages.

Because the choice of language level isn't apparent at DrR expansion-time, I'm guessing. If so, then I agree, though (if I'm correct) my more drastic solution would address this as well.

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20110627/7b6ed02d/attachment.p7s>

Posted on the dev mailing list.