[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessor visibility

This page is part of the web mail archives of SRFI 76 from before July 7th, 2015. The new archives for SRFI 76 contain all messages, not just those from before July 7th, 2015.



Andre van Tonder <andre@xxxxxxxxxxxxxxxxx> writes:

> Just a small question:  Are the accessors visible in the protocol <exp>?

Yes.  This is implied by the fact that the accessors are defined in
the environment of the DEFINE-RECORD-TYPE form.

We actually spent a fair amount of time on the wording spelling out
how the names are bound---i.e. that DEFINE-RECORD-TYPE expands into a
bunch of DEFINEs without saying that it expands into a bunch of
DEFINEs.  If you could suggest on how to improve the spec, that would
be a great help.

> Here is an example that would use this to copy a record.
>
> (define-record-type point
>
>   (protocol
>     (lambda (new)
>       (case-lambda
>         ((x y)       (new x y))                     ; Create new
>         ((old-point) (new (point-x old-point)       ; Copy existing
>                           (point-y old-point)))))
>
>   (fields (immutable x)
>           (immutable y)))

Are you actually asking if we can "do C++" with SRFI 76? :-)

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla