Re: access slot of a class

2023-11-21 Thread Damien Mattei
yes , and the solution i found is to pass the object to the method as argument, then assigning slot to local variables with accessors in the method and the source code from Racket or Kawa. Original code was from Python and i had a bit the same problem, not that slot are not accessible from method,

Re: access slot of a class

2023-11-21 Thread Mikael Djurfeldt
(Sorry, when writing "macro systems", I meant "object orientation systems".) On Tue, Nov 21, 2023 at 11:31 AM Mikael Djurfeldt wrote: > OK, now I see what you are asking. You want the slots to be available as > local variables in the lexical scope of the method. The answer is that that > is not

Re: access slot of a class

2023-11-21 Thread Mikael Djurfeldt
OK, now I see what you are asking. You want the slots to be available as local variables in the lexical scope of the method. The answer is that that is not possible "out of the box". I guess it *could* be made available through some contortionist coding using a combination of GOOPS and the syntax-c

Re: access slot of a class

2023-11-21 Thread Damien Mattei
just forget to say that in my previous examples, <- is a macro that contain a set! case that is used with single variable.(does not use setter, just set!) On Tue, Nov 21, 2023 at 9:19 AM Damien Mattei wrote: > > that is interesting answer about guile's features i did not know , > it is related wi

Re: access slot of a class

2023-11-21 Thread Damien Mattei
that is interesting answer about guile's features i did not know , it is related with code i'm writing that instead of fetching the value modify it using the fetch syntax in Scheme+ but my question was just about how to have a class method in a class that can set! the value of a slot. This does nt

Re: access slot of a class

2023-11-20 Thread Mikael Djurfeldt
Well, if you want to set a slot explicitly using the set! form, and this is a good way to access a slot, you can use an accessor (which internally is a pair of a getter and a setter): (define-class a () (x #:accessor x)) (define o (make a)) (set! (x o) 1) (x o) -> 1 I guess you already know tha

access slot of a class

2023-11-20 Thread Damien Mattei
hi, is there a way to access a slot of a class like other variable with set! , Racket,Kawa allow that, but it does not seem to be the case in Guile. regards, damien