This is the mail archive of the guile@sourceware.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]

Re: SRFI-17



Among the good points made in the discussion of SRFI-17, the one
outstanding technical issue that most puzzles me is the issue
of the dependence of the semantics on whether two procedures are
EQ? (or EQV?).

That is,
  (define kar car)
  (setf! (setter car) strange-set!)
is either illegal (because changing the setter is not allowed), or
changes the setter of CAR.

On the other hand,
  (define (kar x) (begin (set! irrelevant 9) (car x)))
  (setf! (setter kar) strange-set!)
is legal and changes the setter of KAR but not CAR, (because KAR and
CAR are different procedures),

But,
  (define (kar x) (car x))
  (setf! (setter kar) strange-set!)
we don't know what to say (because R5RS does not say whether KAR and
CAR are the same or not...and neither does the SRFI).

The following cryptic and elliptical comment from the SRFI discussion
seems to offer a way out of this muddle:

>  Re: where is srfi-17 going?
>  From: Mikael Djurfeldt mdj@mdj.nada.kth.se
>  Date: 24 Jan 2000 17:24:34 +0100
> 
> We have no supported way of setting the setter associated with a
> getter, but rather have a constructor
> 
>   make-getter-with-setter GETTER SETTER
> 
> with corresponding selector
> 
>   setter GETTER-WITH-SETTER
> 
> This should not create problems for static analysis in the compiler.
> 
> (set! (GWS ARG1 ...) VALUE-FORM) expands to
> 
>   ((setter GWS) ARG1 ... VALUE-FORM)
> ---------------
  Date: Mon, 24 Jan 2000 11:25:46 (CST)
> Sorry, it's
> 
>   make-procedure-with-setter PROCEDURE SETTER
>   procedure PWS
>   setter PWS
> 
> (I'm very busy with other things right now, and don't really have time
>  to spend on this discussion, even though I'd like to.)

If this means that the getter and setter are always created together,
then the problem of deciding EQ?uality of arbitrary procedures can be
avoided.  We just have to put a requirement in the definition of
MAKE-PROCEDURE-WITH-SETTER that it never create the same procedure
twice, that is, the result of one call is never EQ? the result of
another call.  We also avoid any discussion of whether the setter
can be changed; the answer is "no", the getter and setter are
created together and stay bound.  All you can do is create another
pair, possibly with similar procedures (but they will not be EQ? the
originals).

This is a worthy proposal as an alternative to SRFI-17, but it seems
to indicate that SRFI-17 is not implemented in Guile, and that there
is no plan to implement SRFI-17 as it was written.  If this is so, it
seems very strange to propose as a SRFI something that you have
not implemented and have no intention to implement.

-- 
     -- Keith Wright  <kwright@free-comp-shop.com>

Programmer in Chief, Free Computer Shop <http://www.free-comp-shop.com>
         ---  Food, Shelter, Source code.  ---

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]