Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!wuarchive!udel!rochester!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: 11 Jan 91 20:14:18 GMT References: <22307@rouge.usl.edu> <1991Jan10.111559.12440@odin.diku.dk> <27793.278c3bb0@kuhub.cc.ukans.edu> <1991Jan11.100048.3121@odin.diku.dk> Sender: acha@dravido.soar.cs.cmu.edu Organization: Carnegie Mellon University Lines: 22 In-reply-to: sestoft@diku.dk's message of 11 Jan 91 10:00:48 GMT In article <1991Jan11.100048.3121@odin.diku.dk> sestoft@diku.dk (Peter Sestoft) writes: The main difference between Miranda (TM) and Lazy ML is the syntax. In Miranda the program lay-out has semantics: the off-side rule determines where an expression ends, whereas (Lazy) ML has more Pascal-like conventions, using semicolons similar punctuation. (The off-side rule was suggested by Peter Landin in the sixties). What is the justification for this "off-side" rule ? The idea of whitespace having semantics is a potential source of inscrutable bugs and, frankly speaking, seems to go against the grain of modern programming language design. The concrete syntax of such a language would no longer be context-free, let alone LR(1)/LL(1). In fact, I am hard pressed to conceptualize an efficient tokenizing algorithm for such languages. Since this rule has also been incorporated into the design of Haskell, it isn't just historical and I am sure the designers of Haskell must have had some reason(s) for this decision. I would like to know what benefit(s) does this rule provide a language deisgner to trade off against the parsing inconvenience and inelegance ? anurag