[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Smobs and setters?
From: |
Daniel Skarda |
Subject: |
Smobs and setters? |
Date: |
21 May 2001 17:26:57 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
Hello,
in my application I took an advantage of scm_set_smob_apply. Imagine we create
vec3d
vec3d_tag = scm_make_smob_type ("vec3d", 3 * sizeof (double));
I know that the usual Scheme way is to define two function - `vec-ref' and
`vec-set!' for accessing values stored in vec3d. Using setter/getter we would
like to write:
(define v (make-vec 0 1 2))
(v 1)
-=> 1
(set! (v 2) 4)
v
-=> #<vec3d 0 1 4>
It is possible to implement getter (v 1) using scm_set_smob_apply. However it
is not possible to write setter function. It is possible to make procedure with
setter, but it is not possible to attach setter to smobs :-(
I am sorry that my mail ends with "request for feature" instead of patch - but
my knowledge of guile internals is not that deep :(
Best regards,
Dan Skarda
- Smobs and setters?,
Daniel Skarda <=