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

Re: Accessor visibility

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