[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scheme accessors
From: |
Nicolas Sceaux |
Subject: |
scheme accessors |
Date: |
Tue, 24 Feb 2004 19:53:15 +0100 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
I had a cold sweat when running the new 2.1.26, but then read:
"The naming of exported Scheme functions now follows Scheme conventions."
Ouf.
This is just a suggestion:
It may be more idiomatic to define a setter for accessors. For
instance, given the reader ly:music-property and the writer
ly:music-set-property!:
(define-public ly:music-property
(make-procedure-with-setter ly:music-property
ly:music-set-property!))
you can then use ly:music-property to access the property as before,
but you can also use it with set!:
;; return the 'elements property:
(ly:music-property my-music 'elements)
;; set the 'elements property (and return it):
(set! (ly:music-property my-music 'elements) value)
This is more lispy. Note that you can still use the
ly:music-set-property! procedure (thus it does not involve massive
corrections).
nicolas
- scheme accessors,
Nicolas Sceaux <=