Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion the "loop" macro

Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!easynet-tele!easynet.net!easynet-post1!monolith.news.easynet.net!Gareth.McCaughan
From: Gareth.McCaug...@pobox.com (Gareth McCaughan)
Newsgroups: comp.lang.lisp
Subject: Re: the "loop" macro
References: <3B88815A.B5D98835@rcn.com> <MPG.15f2accc162817429896fa@news.dnai.com> <9mb3r4$t1q$1@rznews2.rrze.uni-erlangen.de> <MPG.15f2cd41ada86dfe9896fb@news.dnai.com> <9mbcpu$4ht$1@rznews2.rrze.uni-erlangen.de> <MPG.15f2e299d3bdad509896fd@news.dnai.com>
Reply-To: Gareth.McCaug...@pobox.com
Organization: International Pedant Conspiracy
Message-ID: <slrn9oiqa2.3m4.Gareth.McCaughan@g.local>
User-Agent: slrn/0.9.6.3 (FreeBSD)
Lines: 46
Date: Sun, 26 Aug 2001 22:25:22 +0100
NNTP-Posting-Host: 212.134.20.214
X-Complaints-To: abuse@ukonline.net
X-Trace: monolith.news.easynet.net 998862654 212.134.20.214 (Sun, 26 Aug 2001 22:50:54 BST)
NNTP-Posting-Date: Sun, 26 Aug 2001 22:50:54 BST

John Foderaro wrote:

> One of the problems I have with the if special form occurs at the of the
> bar function.  It's pretty easy to get confused and think that the dotimes
> at the end is always executed.   At first glance you may not see the
> indentation difference between the if and dotimes.

where the BAR function looks, in outline, like this.

    (defun bar ()
      (if something
          stuff-to-do-when-true
        stuff-to-do-when-false))

It seems to me that the blame here lies not with IF, but
with the peculiar convention, which I have never understood,
that indents the "then" and "else" parts of an IF differently.
It would almost make sense if the "else" part of an IF had an
implicit PROGN, but it doesn't.

With indentation more like

    (defun bar ()
      (if something
        stuff-to-do-when-true
        stuff-to-do-when-false))

it is much harder to miss the fact that the two consequent
clauses are indented by the same amount.

Perhaps someone can enlighten me. Why is IF so often indented
in this strange way? (Non-answer: "Because that's what emacs
lisp-mode does." So, why does emacs lisp-mode do it?)

In the particular case John Foderaro posted, the stuff-to-do-when-true
is moderately long (17 lines). If that's too long to be able to see
how the indentation lines up, well, that's a pity, but that sort of
issue arises absolutely all the time and there ought to be better
solutions than changing the syntax. Do we need a new syntax to
replace LET, with explicit end-of-scope markers? A new syntax for
function call, so you can't get confused about what function any
given thing is an argument to? That way lie XML and madness...

-- 
Gareth McCaughan  Gareth.McCaug...@pobox.com
.sig under construc