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]

Re: difficulty of writing translators



jimb@red-bean.com writes:
> 
> > I'm not proposing it as anything. I was just commenting on Per's
> > suggestion in a general way. He said he hadn't thought of a way to
> > allow setters to be set for user-defined procedures, so I suggested
> > one.
> 
> Ah, okay.  Glad I asked...
> 
> 
> At first blush, it seems like the analysis needed to determine a
> setter at compile time (and thus generate (set-car! foo bar) from
> (set! (car foo) bar)) would be the same as that required to in-line
> things like car and cdr.

Well, pretty similar; you'd have to both make sure the `car' variable
was never set! or defined and that the car procedure object's setter
was never altered. Of course, you wouldn't want to do it literally as
a source transform of the sort above, since this transform can be done
safely wether or not `set-car!' is redefined. However, to do either of
these sanely in the presence of load, you'd need a module system
construct that expresses importing a copy of the R4RS bindings that no
other module can alter, and guarantee that code will not be `load'ed
into the current module.

 - Maciej