chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Make result of empty "else" clause undefin


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Make result of empty "else" clause undefined in `cond' and `case' forms
Date: Thu, 12 Apr 2018 14:54:42 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On Thu, Apr 12, 2018 at 01:40:42PM +0100, Alaric Snell-Pym wrote:
> 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
> imperative-style code.
> 
> (cond
>   ((= 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
> 100"))
>   (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 :-)

I agree, this should not necessarily warn.  We already will emit a
warning when you use the result of the expression in a procedure call
to a procedure which does not accept arguments of the void type.

Cheers,
Peter

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]