This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: SRFI-17
- To: guile at sourceware dot cygnus dot com
- Subject: Re: SRFI-17
- From: Marius Vollmer <mvo at zagadka dot ping dot de>
- Date: 21 Feb 2000 02:28:28 +0100
- References: <E12Clym-0004ZS-00@mdj.nada.kth.se> <200002110617.BAA00647@fcs9.free-comp-shop.com>
Keith Wright <kwright@gis.net> writes:
> It can be troublesome to remember the name of the setter that goes
> with your favorite getter, both because setters are used less (some
> large programs _never_ use them), and because the naming conventions
> are haphazard by tradition and standard.
I think another powerful argument for a generalized `set!' (or
`setf!') is that it allows you to write useful macros like `push!',
`pop!' etc that use getters and setters to modify a certain location
(or whatever is accessed by the getter/setter).
For example, you could define (sorry, I'm not fluent with syntax-case)
(define-macro (loc expr)
`(lambda args
(if (null? args)
,expr
(set! ,expr (car args)))))
(define (loc-ref l)
(l))
(define (loc-set! l v)
(l v))
and have an abstraction for something like lvalues.
- Marius