Yes, this looks like a bug. I see something went wrong between
versions 6.6 and 6.7.

As for `define` vs `define/private`, they are not the same. In the
`define` case, storage is allocated in the object (since it is a
field, bound to a procedure) and in the `define/private` case, it
isn't (since it is a method).

Robby

On Thu, Aug 16, 2018 at 12:37 PM 'Paulo Matos' via Racket Users
<racket-users@googlegroups.com> wrote:
>
> Hi,
>
> I spent a whole day trying to find and then reduce an issue I was having
> with my software. A procedure, suddenly, was just not being called. It
> was as if the call was just gone - pufft. Nothing I did helped.
>
> I was confused - but after a day I managed to reproduce this with a
> ridiculously simple case and it looks like it might be a bug.
>
> Run:
>
> #lang racket
>
> (define myc%
>   (class object%
>     (super-new)
>
>     (define/public (foo x #:arg (k 0))
>       (printf "foo~n")
>       (foo* x #:arg k))
>
>     (define/private (foo* y #:arg k)
>       (printf "foo*~n")
>       (bar y (add1 y) (* y 2)))
>
>     (define/private (bar x y z)
>       (printf "~a ~a ~a~n" x y z))))
>
> (define c (new myc%))
> (send c foo 2)
>
>
> That works just fine, right? It prints '2 3 4'
>
> Now try changing the foo* definition to using define/private as in:
> (define/private (foo* y #:arg k) ...)
>
> Nothing... The call enters foo* though but bar is never called!
> If instead you do just:
> (define (foo* ...) ...)
>
> it works again! For me this is the most horrible realization because I
> always assumed
> (define (foo ...) ...) was the same as (define/private (foo ...) ...)
>
> First, is this not the case?
> Second, is this a bug? Why does this happen? Shall an issue be opened?
>
> Kind regards,
>
> --
> Paulo Matos
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to