[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Make result of empty "else" clause undefin
Re: [Chicken-hackers] [PATCH] Make result of empty "else" clause undefined in `cond' and `case' forms
Thu, 12 Apr 2018 13:40:42 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
On 10/04/18 09:49, address@hidden wrote:
>> Thanks for pointing this out, Jörg.
>> I think making this case *actually* undefined would be OK. In other
>> words, treat it like a one-armed if or (cond-expand (else)).
>> It might be nice to add a warning, too, but that's a bigger patch so we
>> can start with this. Hackers, your thoughts?
> Sounds reasonable.
I think this is good, and doesn't need a warning. I think it could be a
legitimate statement of intent to create an empty else when writing
((= guess target) (display "You guessed correctly!"))
((zero? guess) (display "You're not even trying!"))
((> guess 100) (display "C'mon, you know the number's never more than
(else)) ;; in all other cases, do nothing
It declares that an unhandled case is *meant* to do nothing, rather than
being an omission on the part of the author.
However, if others can think of likely situations where this is a
mistake, I'll concede a warning :-)