I understand, I would have preferred something more explicit, like using define 
for fields as it is but then instead of using define again for methods, with 
possibly public or private annotations to have something like 
define-method/public and define-method/private.

It feels to me that allowing this 
(define (f x) 2)
To be a field and then with
(public f)

Transforming it into a method makes it slightly more confusing. 

On 16 August 2018 20:56:24 CEST, Robby Findler <ro...@eecs.northwestern.edu> 
wrote:
>That probably would have been better but we opted to reuse the
>definition
>of the define macro. Too clever by half (maybe).
>
>Robby
>
>On Thu, Aug 16, 2018 at 1:40 PM 'Paulo Matos' via Racket Users <
>racket-users@googlegroups.com> wrote:
>
>>
>>
>> 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.
>>
>
>-- 
>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.

Reply via email to