[Top][All Lists]

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

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

From: Alaric Snell-Pym
Subject: Re: [Chicken-hackers] [PATCH] Make result of empty "else" clause undefined in `cond' and `case' forms
Date: Thu, 12 Apr 2018 13:40:42 +0100
User-agent: 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
imperative-style code.

  ((= 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 :-)


Alaric Snell-Pym

reply via email to

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