Article View: comp.lang.functional
Article #764Re: "off-side rule"
From: Per Bothner
Date: Wed, 23 Jan 1991 19:20
Date: Wed, 23 Jan 1991 19:20
46 lines
2205 bytes
2205 bytes
>All this to save a few characters?
The point, I think, is not save a few characters,
but to save a few lines (and saving lines is useful,
because it allows you to get more of a program
on the screen).
Consider C indentation rules:
if (test) {
statement1;
statement2;
}
Note the final line. This is needed for the final delimiter,
but contains no useful information. It wastes cathode rays/paper.
It puts extra white space in a useless and ugly place.
You could use a Lisp-style of formatting, where the final
delimiter is on the last "real" line:
if (test) {
statement1;
statement2;}
But now the last statement is different from the other(s),
which is esthetically ugly and makes updating error-prone.
I find it hard to take seriously people's concerns about
tabs. A program with tabs whose intervals are not every
8th character is already non-portable (it will look a mess
when viewed on a normal system), and it is in any case
an easy problem to fix in your editor, in your
communication software, or with an explicit filter.
So, I believe it may be reasonable to make syntactic use of
indentation. The specifics of Haskell's particular off-side
rule is a different issue. I suggest that the rule
should be relative indentation of lines, not syntatic units.
That is, I would prefer something like:
if (test)
statement1
statement2
instead of:
if (test) statement1
statement2
--
--Per Bothner
bothner@cs.wisc.edu Computer Sciences Dept, U. of Wisconsin-Madison
Technical Details
Message-ID:
<1991Jan23.192057.8041@spool.cs.wisc.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!zazen!uwvax!sevenlayer.cs.wisc.edu!bothnerReferences:
<ACHA.91Jan17120316@DRAVIDO.CS.CMU.EDU> <SPOT.91Jan22160231@WOOZLE.GRAPHICS.CS.CMU.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!zazen!uwvax!sevenlayer.cs.wisc.edu!bothner From: bothner@sevenlayer.cs.wisc.edu (Per Bothner) Newsgroups: comp.lang.functional Subject: Re: "off-side rule" Message-ID: <1991Jan23.192057.8041@spool.cs.wisc.edu> Date: 23 Jan 91 19:20:57 GMT References: <ACHA.91Jan17120316@DRAVIDO.CS.CMU.EDU> <SPOT.91Jan22160231@WOOZLE.GRAPHICS.CS.CMU.EDU> Sender: news@spool.cs.wisc.edu (The News) Reply-To: bothner@sevenlayer.cs.wisc.edu (Per Bothner) Distribution: comp Organization: University of Wisconsin--Madison Lines: 46