This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
> However, it would please me (if it's not too deadly to implement) to > see functions allowed to return set!-able references: > (set! (my-prop) 17) > (my-prop) => 17 Kawa supports this (for some primitive functions - I haven't decided yet how to define such functions in Scheme). Note that having functions "return set!-able references" is probably not the way to do it, since we want a normal call (not in a set! context) to return plain value, not a reference. Instead, we allow functions to have "attributes", and one attribute is a functions setter function. Then we define: (set! (f . args) value) as being syntactic sugar for: ((setter f) value . args) > (While I'm at it, I'd argue for (set! (array-ref a 6) 'zork) etc. as a > clean alternative to setf.) The advantage of this design is that it is procedural, while setf is macro-based. Hence setf only works for setter functions explicitly known (by name) at compile time, but setter works on procedure *values* at run-time, and is therefore much more in the spirit of Scheme. --Per Bothner Cygnus Solutions bothner@cygnus.com http://www.cygnus.com/~bothner