[racket] racket/place seems to be incompatible with DrRacket
I completely forgot the concept that some modules exist only bound to a
namespace.
Your example helped me understand the problem better.
My analysis of the problem and and suggested solution were way off.
So I apologize.
On 08/30/2011 01:46 PM, Robby Findler wrote:
> DrRacket is naming them. They are named 'anonymous-module and are put
> into the current-namespace. (Changing the module-name-resolver in that
> manner seems like a bad idea to me -- and modules can exist just
> attached to the namespace like that. For example, '#%place is one such
> module that you are familiar with.)
>
> One simple-to-fix problem with 'place' was that it was not correctly
> handling symbols as module names. I've pushed a fix. (You should
> probably look at the commit message for some other, minor comments on
> the code.)
Thanks, your other changes were insightful too. I learned a few things.
> One harder-to-fix problem (at least for me) is that dynamic-place does
> not handle such modules. I don't know if the fix is to signal an error
> or to improve how places are started, but here is an example of how
> dynamic-place is being called in this case.
I talked with Matthew and I am going to add code that detects symbol
module names
and throws an error before the new place is ever created.
>
> #lang racket
>
> (define ns (make-base-namespace))
> (parameterize ([current-namespace ns])
> (eval '(module m racket/base (define (f pc) (printf "hi\n"))))
> (eval '(require 'm))
> (eval '(require racket/place))
> (eval '(dynamic-place ''m 'f)))
>
> This produces this error:
>
> dynamic-require: unknown module: 'm
>
> which should be unsurprising to you, because the newly created place
> doesn't get the module 'm.
>
> A third problem: the error is printed to the original stdout of
> DrRacket (which is probably why you and David Mitchell didn't see it).
> It would be better if there were some error handling code that
> transmitted the exception record (or perhaps just the message field)
> back to the original place for rendering there. I'm thinking
> specifically in the case that the initial require fails. (I think I've
> mentioned this before so if there's some reason I'm missing that keeps
> this from being changed, please let me know.)
I'm going to add a feature that allows the user to specify file ports or
racket pipes for a new place's standard in, out, and err ports.
In the Drracket case, I'll detect that that the current-error-port isn't
a file port or racket pipe and set up an IO pump that
pumps a place's standard IO ports into the current Drracket ones.
I think that should provide good error messages and solve the confusion
David Mitchell experienced
Kevin
>
> Robby
>
> On Tue, Aug 30, 2011 at 1:32 PM, Kevin Tew<tewk at cs.utah.edu> wrote:
>> Place are spawned by dynamically requiring a module.
>>
>> It appears that an unsaved module in drracket gets the name
>> "anonymous-module" and the module-name-resolver doesn't know how to find
>> "anonymous-module".
>>
>> I think drracket needs to uniquely name these anonymous-modules and then
>> install a
>> module-name-resolver that can return the correct anonymous module when
>> asked.
>>
>> I assume these anonymous modules exist in the drracket environment, just not
>> on disk.
>>
>> Kevin
>>
>> On 08/30/2011 12:12 PM, Robby Findler wrote:
>>> Kevin: when I follow the steps exactly as written, I get this error
>>> message on stdout (under windows):
>>>
>>> standard-module-name-resolver: collection not found: "anonymous-module" in
>>> any o
>>> f: (#<path:C:\Users\robby\AppData\Roaming\Racket\5.1.3.6\collects>
>>> #<path:C:\Use
>>> rs\robby\git\exp\plt\collects>)
>>>
>>> I believe this to be a bug in the implementation of 'place' and to
>>> have something to do with the name of the source locations that
>>> DrRacket uses when the file is not saved.
>>>
>>> Robby
>>>
>>> On Tue, Aug 30, 2011 at 12:14 PM, Kevin Tew<tewk at cs.utah.edu> wrote:
>>>> When I run the code below in drracket, the code seems to run
>>>> indefinitely.
>>>> When I hit the stop button the (place-channel-get p) sexp is highlighted
>>>> in
>>>> pink.
>>>>
>>>> Kevin
>>>> On 08/30/2011 08:54 AM, David Mitchell wrote:
>>>>
>>>> #lang racket
>>>> (define (super-simple)
>>>> (define p
>>>> (place ch
>>>> (place-channel-put ch 5)))
>>>> (place-channel-get p))
>>>>
>>>> _________________________________________________
>>>> For list-related administrative tasks:
>>>> http://lists.racket-lang.org/listinfo/users
>>>>
>>