Subject: Re: On conditionals
From: Erik Naggum <erik@naggum.net>
Date: Wed, 21 Nov 2001 18:57:34 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3215357851897754@naggum.net>

* Espen Vestre
| the perl "expression if" does not work that way:

  Perl is not a language worth comparing anything to.

| (perl's _unless_, which can't be mentioned often enough since some people
|  think lisp is the only language with such an animal, can of course also
|  be used as a "expression unless").

  Just being postfix does not make it an expression.

* Erik Naggum
> One question is whether a form should be used for its value or not.  The
> forms when and unless should clearly not be used for their value. 

* Espen Vestre
| I strongly disagree. I think when and unless can be perfectly well used
| for their value. In general I think the Common Lisp programmer should be
| free to use any form for it's value whenever that value can be given a
| meaningful interpretation.

  Well, unlike what a Perl hacker will expect,

(setq foo (when bar zot))

  actually does modify foo when bar is false.  I think using the one-branch
  conditionals when and unless for value is highly, highly misleading.

  However, if they are used in a function body as the value-returning form
  and it is defined to return nil when "nothing happens", I think it is
  much more perspicuous to have an explicit (return nil) form under the
  appropriate conditions than let when or unless fall through and return
  nil by default, which can be quite invisible.

///
-- 
  Norway is now run by a priest from the fundamentalist Christian People's
  Party, the fifth largest party representing one eighth of the electorate.
-- 
  Carrying a Swiss Army pocket knife in Oslo, Norway, is a criminal offense.