On 16/08/18 19:42, Robby Findler wrote: > Yes, this looks like a bug. I see something went wrong between > versions 6.6 and 6.7. > Thanks, opened #2232. > 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). > That, of course, makes total sense after you said it. I however, thought that something like: (define f 2) would define a private field and (define (f x) 2) would define a private method, but what I didn't realise is that at the implementation level, there must be a way to identify a field which is a lambda and a method because one is part of the object and the other part of the class. Thanks! > 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. > -- 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.
Re: [racket-users] Interaction between define/private and keyword arguments
'Paulo Matos' via Racket Users Thu, 16 Aug 2018 11:40:40 -0700
- [racket-users] Interaction between define/p... 'Paulo Matos' via Racket Users
- Re: [racket-users] Interaction between... Robby Findler
- Re: [racket-users] Interaction bet... 'Paulo Matos' via Racket Users
- Re: [racket-users] Interaction... Robby Findler
- Re: [racket-users] Interac... 'Paulo Matos' via Racket Users