[racket] racket/place seems to be incompatible with DrRacket

From: David Mitchell (dave at fallingcanbedeadly.com)
Date: Tue Aug 30 10:54:58 EDT 2011

Steps:

1. Open DrRacket
2. In the definitions window, paste in

#lang racket

(define (super-simple)
  (define p
    (place ch
           (place-channel-put ch 5)))
  (place-channel-get p))

3. Click the "Run" button in the toolbar
4. In the REPL, type "(super-simple)"

The call to provide is necessary when loading code in the Terminal, but it
doesn't seem necessary with DrRacket. In fact, based on the comment I saw in
IRC about DrRacket reloading the module, I wonder if that has something to
do with it. (although I'm new enough to Racket to not put much stock in my
intuitions)

— Dave

On Tue, Aug 30, 2011 at 7:19 AM, Robby Findler
<robby at eecs.northwestern.edu>wrote:

> I'm not seeing bad behavior so probably I'm doing something slightly
> differently than you, which is making the difference. If you have the energy
> to send a precise set of steps I'm happy to try them on my machine and maybe
> that'll help us sort it out.
>
> Robby
>
>
> On Tuesday, August 30, 2011, David Mitchell <dave at fallingcanbedeadly.com>
> wrote:
> > I tried saving the module and putting a require in the DrRacket window,
> and that works correctly. I think this will be an acceptable workaround for
> the time being, but I'd really like to know more about what's going on.
> >
> > -- Dave (on the iPhone)
> >
> > On Aug 30, 2011, at 4:44 AM, Robby Findler <robby at eecs.northwestern.edu>
> wrote:
> >
> >> I'm sorry; I was wrong.
> >>
> >> I don't see the behavior you're seeing, tho. If I add parens around
> >> 'all-defined-out', and save the file in tmp.rkt, then this is the
> >> behavior I see at the command-line racket:
> >>
> >> Welcome to Racket v5.1.3.6.
> >>> (require "tmp.rkt")
> >>> (super-simple)
> >> 5
> >>
> >> and I see similar behavior in DrRacket:
> >>
> >> Welcome to DrRacket, version 5.1.3.6--2011-08-25(7bb8c6c4/d) [3m].
> >> Language: racket; memory limit: 128 MB.
> >>> (super-simple)
> >> 5
> >>>
> >>
> >> FWIW, in 5.1.3, I get an error that's surprising to me, as I don't see
> >> how the sandbox gets involved in this program, but here it is:
> >>
> >> car: expects argument of type <pair>; given '#((module program
> racket/base))
> >>
> >> === context ===
> >> /Applications/Racket v5.1.3/collects/racket/sandbox.rkt:572:17: ns
> >> /Applications/Racket v5.1.3/collects/racket/sandbox.rkt:584:20
> >> /Applications/Racket v5.1.3/collects/racket/sandbox.rkt:334:0:
> call-with-limits
> >> /Applications/Racket v5.1.3/collects/racket/sandbox.rkt:564:0:
> evaluate-program
> >> /Applications/Racket
> >> v5.1.3/collects/racket/private/more-scheme.rkt:151:2:
> >> call-with-break-parameterization
> >> /Applications/Racket v5.1.3/collects/racket/sandbox.rkt:704:2:
> user-process
> >> /Applications/Racket
> v5.1.3/collects/mred/private/wx/common/queue.rkt:430:6
> >> /Applications/Racket
> v5.1.3/collects/mred/private/wx/common/queue.rkt:470:32
> >>
> >> Robby
> >>
> >> On Mon, Aug 29, 2011 at 8:55 PM, David Mitchell
> >> <dave at fallingcanbedeadly.com> wrote:
> >>> You might have to unpack that a little bit more for me, as I don't see
> how that's the case. Additionally, why would it work from Terminal and not
> DrRacket?
> >>>
> >>> -- Dave (on the iPhone)
> >>>
> >>> On Aug 29, 2011, at 6:32 PM, Robby Findler <
> robby at eecs.northwestern.edu> wrote:
> >>>
> >>>> I think what's happening is that you're creating a place whose first
> >>>> action is to create that same place again (over and over).
> >>>>
> >>>> Robby
> >>>>
> >>>> On Mon, Aug 29, 2011 at 8:17 PM, David Mitchell
> >>>> <dave at fallingcanbedeadly.com> wrote:
> >>>>> I've been trying to experiment with racket/place, but it seems to
> have
> >>>>> significant incompatibilities with DrRacket. I've defined a module
> based on
> >>>>> a code snippet in
> http://www.cs.utah.edu/plt/publications/dls11-tsffd.pdf
> >>>>> that looks like this:
> >>>>>
> >>>>> #lang racket
> >>>>> (provide all-defined-out)
> >>>>> (define (fib n)
> >>>>>   (define (fib-inner n-remaining i i+1)
> >>>>>     (if (= n-remaining 1)
> >>>>>         i+1
> >>>>>         (fib-inner (- n-remaining 1) i+1 (+ i i+1))))
> >>>>>   (if (<= n 0)
> >>>>>       0
> >>>>>       (fib-inner n 0 1)))
> >>>>> (define (start-fib n)
> >>>>>   (define p
> >>>>>     (place ch
> >>>>>            (define n (place-channel-get ch))
> >>>>>            (place-channel-put ch (fib n))))
> >>>>>   (place-channel-put p n)
> >>>>>   p)
> >>>>> (define (super-simple)
> >>>>>   (define p
> >>>>>     (place ch
> >>>>>            (place-channel-put ch 5)))
> >>>>>   (place-channel-get p))
> >>>>>
> >>>>> If I run racket in my Terminal and load this module, I'm able to use
> >>>>> start-fib and super-simple as expected. However, if I define this
> module in
> >>>>> the DrRacket editor and access the functions through the repl,
> attempts to
> >>>>> rec
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110830/b5372b25/attachment.html>

Posted on the users mailing list.