Guile Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setf.scm
>>>>> "Mikael" == Mikael Djurfeldt <mdj@nada.kth.se> writes:
Mikael> What do you mean?
Mikael> (x o 1)
Mikael> (x o) -> 1
Yep. This way you only get the symbol you have asked for; `x' truely
becomes an accessor. I like setf! better, but the above is preferable
to set-x! IMHO.
Mikael> I think
Mikael> (set-x! o 1)
Mikael> (x o) -> 1
Mikael> is clearer.
But it still introduces `set-x!' which I think it shouldn't. The user
did not ask for that, he had concerned himself with `x'.
Mikael> I don't think it is arbitrary.
Ok, perhaps it isn't completly arbitrary, but there is a range of
possible choices and the problem is not unique to objects, so picking
any particular one has elements of arbitrariness.
A former colleague taught me that what is a logical name to one person
invariably is the opposite to somebody else. Thus *any* autogenerated
name should be considered with great scepticism.
And isn't that unschemish if anything? In the clean world of pure (R4RS)
scheme, there is nothing beyond `define' that permanently introduces
a global name binding.
Mikael> And, besides, if the user isn't happy about set-x! he can
Mikael> choose a better name himself with #:setter, and he doesn't
Mikael> even need to create getter or setter names at all.
Well, if he wants `set-x!', he could use #:setter. Suppose you hate
the idea of `set-x!', with the above scheme you have to specify both
#:getter and #:setter *everywhere* you in CLOS and STk would have used
just #:accessor.
Mikael> It may also be more consistent to rename #:accessor to #:accessors if
Mikael> it's going to generate both `x' and `set-x!'. (Logic: Both mutators
Mikael> and selectors are "accessors".)
Only if you insist on introducing two different names into the users
namespace.
Where a getter or a setter is one or the other, an accessor is both.
---------------------------+--------------------------------------------------
Christian Lynbech | Telebit Communications A/S
Fax: +45 8628 8186 | Fabrik 11, DK-8260 Viby J
Phone: +45 8628 8177 + 28 | email: chl@tbit.dk --- URL: http://www.telebit.dk
---------------------------+--------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
- petonic@hal.com (Michael A. Petonic)
Guile Home |
Main Index |
Thread Index