[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Improper lists
>>>>> "Olin" == Olin Shivers <shivers@xxxxxxxxxxxxxxxxxxxxxxx> writes:
Olin> I think that the whole idea of "robustness" (meaning don't break under
Olin> any circumstances) is not in a Scheme tradition:
Olin> Depends on what you mean by robustness! Scheme has a great tradition of
Olin> the kind of robustness associated with "safe" languages.
Safety doesn't come into it. The question is whether the system goes
into a defined state in the face of undefined behavior. Signalling
an error is totally acceptable. (ML does this even before run time
Olin> What I meant by robust was "has a spec that operates on the full set of
Olin> possible input values." But let's not get hung up on a word.
So, guaranteeing that an error is signalled is not robust?
Olin> Now, you can focus on pairness, and still rule out improper lists by
Olin> writing this definition:
Olin> (let recur ((x x))
Olin> (cond ((pair? x) (cons (car x) (recur (cdr x))))
Olin> ((null? x) y)
Olin> (else (error ...))))
Olin> All this means, however, that we basically coded in a gratuitous
Olin> restriction to our definition that wasn't at all needed.
But you also get something in return: better error reporting. The
uncommon case of the improper list is IMHE *so* uncommon that it
doesn't warrant sacrificing error reporting for it.
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla