accessor, getter setter for kawa class

Damien Mattei damien.mattei@gmail.com
Mon Oct 16 13:30:55 GMT 2023


hello Ἀλκείδης

in fact, as written in the manual , a lot of Guile GOOPS procedure are
ported to Kawa, like slot-ref and this give this code:

(define (matrix-v M)
  (slot-ref M 'v))

to have the same getter than in Guile or Racket for a matrix class:

(define-simple-class matrix ()

  (v::vector)

  ((*init* (vParam::vector))
   (set! v vParam))

  )

(matrix-v M)
#(#(0 1 2) #(1 2 3))


On Mon, Oct 16, 2023 at 1:41 PM Ἀλκείδης FP <alcides.fp@gmail.com> wrote:
>
> Hi Damien.
>
> AFAIK, there aren't such predefinded accesors in Kawa classes.
>
> To achieve the same goal I usually do one of the following:
>
> a) Leave the field as public and use it directly.
>
> b) Define a parent class (abstract or not) in Java and use Lombok annotations (@Getter, @Setter, @Data, etc)
>
> Greetings.
>
> El lun., 16 de octubre de 2023 6:19, Damien Mattei via Kawa <kawa@sourceware.org> escribió:
>>
>> are there predefined getter or setter for a field of a kawa class?


More information about the Kawa mailing list