Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!dravido.soar.cs.cmu.edu!acha From: acha@CS.CMU.EDU (Anurag Acharya) Newsgroups: comp.lang.functional Subject: "off-side rule" Message-ID: Date: 17 Jan 91 17:03:16 GMT Sender: acha@dravido.soar.cs.cmu.edu Distribution: comp Organization: Carnegie Mellon University Lines: 20 Thanks for all the info on the "off-side rule". As far as I could make out, the rule is motivated by a desire to make the syntax of programming languages look as close to that of mathematical functions as possible. As the post on Haskell mentioned, the layout is preprocessed into a set of tokens in a phase between the lexer and the parser. Such functionality would be better placed in an editor rather than in the compiler. We already have the "electric-this", "electric-that" modes in gnu-emacs. It should be a simple job to extend these modes to include the "off-side rule" if so desired. Why complicate the language definition with such inelegant constructs ? Of course, if one is indeed going to depend on the programmers to do the indentation right, one might expect them to put in the delimitors. A point that is made in the defence of the "off-side rule" is that the indentation, if "properly" done, renders the delimitors redundant -- so we should do away with them. This is, however, useful redundancy -- in that it allows the compiler to detect any inadvertent errors that might occur. anurag