Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!sansom From: sansom@cs.glasgow.ac.uk (Patrick Sansom) Newsgroups: comp.lang.functional Subject: Re: "off-side rule" Message-ID: <7495@vanuata.cs.glasgow.ac.uk> Date: 21 Jan 91 14:58:59 GMT References: <7931@castle.ed.ac.uk> Distribution: comp Organization: Computing Sci, Glasgow Univ, Scotland Lines: 37 aipdc@castle.ed.ac.uk (Paul Crowley) writes: >I am both attracted to and repelled from the off-side rule - it provides >potential both for more readable code and for horrendously intractable >bugs. >My question is: why not write the _language_ so that white space is not >significant (except as a separator) but write a _filter_ which turns >"off-side" code into "non-off-side" code. That way, people who don't >like the rule never have to think about it - foreign code can be pushed >through the filter and then edited. >A filter the other way might be nice but wouldn't be essential. >... >\/ o\ Paul Crowley aipdc@uk.ac.ed.castle >/\__/ Trust me, I know what I'm doing. Yes I agree with this _filter_ idea. My honours project in 1989 was looking at initial Haskell specifications and included implementing the formatting rules in a pre-processor / filter which inserted brackets { } and semi-colons where appropriate. The modified source was then given to the compiler. In fact, the specification of the layout rule in the Haskell report is actually specified as a translation on source code. Having the pre-processor as a seperate entity allows any source code to be processed before distribution to remove any possibility of ambiguity. -- Patrick Sansom | E-Mail: sansom@cs.glasgow.ac.uk Computing Science Research Student | University of Glasgow |