[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new function or modify read

This page is part of the web mail archives of SRFI 38 from before July 7th, 2015. The new archives for SRFI 38 contain all messages, not just those from before July 7th, 2015.



Marc Feeley <feeley@xxxxxxxxxxxxxxxx> writes:
> Of course you can shoot yourself in the foot if your new code does
> (parameterize (...) (some-other-function-than-write)).  

Or even:

        (parameterize (...)
           (write
            (your-object-generation-function-with-debugging-code-underneath)
            port
            ))

In the absence of good Scheme debuggers (of which I am finding that
Gambit's is among the best), this is problematic. Yes, I can simply
let-transform the above, but Michael's point is about parameterize
having the wrong scope. This is why I prefer using a readtable as a
third param to write. It attaches the altered behavior to the correct
scope, the single write call. You alternative about associating a
readtable with a port is better than parameterize, and may even be
handy wnough to put up with the potential for nasty surprises, I just
haven't thought about it enough yet. The dynamic extent of the
parameterize call is simply *not* correct.

david rush
-- 
In a profession plagued by, "when all you have is a hammer, everything
looks like a nail," we get really excited when someone is able to come
along and prove that everything really *is* a nail if lambda is the
hammer.                         -- Bruce R Lewis (on comp.lang.scheme)