[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] Clean versus pure in types.db
From: |
John Cowan |
Subject: |
Re: [Chicken-hackers] Clean versus pure in types.db |
Date: |
Mon, 12 Mar 2012 13:16:35 -0400 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Jörg F. Wittenberger scripsit:
>> I've never had much sympathy for the CL and R6RS viewpoint that
>> programmers should be able to count on a run-time exception being
>> raised when they've done something silly.
>
> Just because silly programs exist. I've contributed to that pile
> myself.
I didn't express myself too well there.
What I meant was that in R6RS, if you write (car 13), you can reliably
count on getting a run-time exception. An R6RS-conformant compiler
*must not* reject this program, though it might implement it as a call to
`raise` instead of `car`. I would much rather have the compiler reject
such a program early, as is permitted by R5RS (and R7RS) semantics,
where such a program "is an error" (and so the implementation can do
what it wants).
The effective difference (as I understand it) between "clean" and "pure"
is that the compiler can't remove a call to a "clean" procedure whose
result is unused because it *might* raise an exception that the programmer
*might* rely on catching. In the case of a call to a known procedure on
arguments of known type, where the result is not used but the interpreter
definitely *would* raise an exception, I'm okay with letting the compiler
suppress the unnecessary call. If the programmer wants to raise a bad
argument type exception, they should do so explicitly.
--
The first thing you learn in a lawin' family John Cowan
is that there ain't no definite answers address@hidden
to anything. --Calpurnia in To Kill A Mockingbird