Re: [Scheme-reports] [r6rs-discuss] redefining eqv?
Peter Kourzanov 22 Dec 2010 20:47 UTC
On Wed, 2010-12-22 at 15:15 -0500, John Cowan wrote:
> I haven't found any Schemes except Scheme 9 on which this fails, but
> there is nothing in any Scheme standard to make it work. In C, on the
> other hand, the equivalent construction is not allowed to fail: fopen()
> is naturally definable in terms of open(), but if you define your own open(),
> it cannot affect the behavior of fopen() on conformant ISO C systems.
That's because the definition of open() (typically a macro) is captured
when an unnamed library containing fopen() is compiled (for performance
reasons). And it is typically a direct interrupt to the OS. On the other
hand, with fopen() itself, you can play LD_PRELOAD tricks, hijack other
functions from that same library, or play linker tricks or ...
>
> On the gripping hand, if you define your own length in terms of cdr
> (as is natural), you will get a failure if cdr is redefined later in the
> REPL.
>
> The problem's a mess.
>
Can we do anything about it in the interpreter besides special-casing
a whole bunch of functions from the base library?
And should we do anything about it? Not that there are no other ways of
shooting yourself in the foot (see above)...
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports