Article View: comp.lang.functional
Article #644let/where syntax war
From: John Farrell
Date: Sun, 04 Oct 1992 23:38
Date: Sun, 04 Oct 1992 23:38
41 lines
2700 bytes
2700 bytes
In <BvHIwz.9HM@comp.vuw.ac.nz> brian@comp.vuw.ac.nz (Brian Boutel) writes: >In article <farrell.718005712@coral>, farrell@coral.cs.jcu.edu.au (John Farrell) writes: |>However I don't like the ML/Haskell convention of using |>"let x = y in z" rather than "z where x = y", I like to read programs top down |> rather than bottom up. >Consider > let x = y in if a then b else c >and > if a then b else let x = y in c >Now consider > if a then b else c where x = y >To which of the let forms does this correspond? >It's ambiguous, and an arbitrary decision has to be made as to which parse to >use. This is dangerous, as a wrong assumption can result in a syntactically >correct program with entirely the wrong meaning. To me it seems that "let" is a command to the reader, and by the time I have informed myself that x = y, I have forgotten why I was reading the code in the first place. I think "let" sounds more like an imperative command than a functional expression, e.g. "LET" is BASIC syntax. Anyway, while I'm at it, I don't like the "a | b = c" syntax either, but I suspect that's because I haven't learnt to read "|" as being "if" and "=" as being "then". I much prefer some sort of arrow notation, but I can't think of a good one right now. As people who don't know me might have guessed, I'm a Miranda weenie and I love Miranda syntax (BTW, if David Turner is reading this, I am moving to Gofer because it is free and is available on the PC). Now continuing my love of ambiguity, I would like to say that I don't care if a language is ambiguous, just so long as I know what it means :-). I.e. I would much rather write "where" clauses with brackets to resolve ambiguity than write "let" expressions which confuse me straight away. Which reminds me! Why the difference between "let" and "letrec"? Surely we have got past the stage of explicity flagging recursive functions? I know that (well, I believe that) an expression can have different meanings depending on whether a token is a "let" or a "letrec", but surely it's dangerous to have a name refer to two different values depending on three little letters? John
Technical Details
Message-ID:
<farrell.718241931@coral>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!marlin.jcu.edu.au!coral.cs.jcu.edu.au!farrellReferences:
<TMB.92Sep28144424@arolla.idiap.ch> <annius.717696151@freyr> <farrell.718005712@coral> <BvHIwz.9HM@comp.vuw.ac.nz>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.functional Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!marlin.jcu.edu.au!coral.cs.jcu.edu.au!farrell From: farrell@coral.cs.jcu.edu.au (John Farrell) Subject: let/where syntax war Message-ID: <farrell.718241931@coral> Sender: news@marlin.jcu.edu.au (USENET News System) Organization: James Cook University References: <TMB.92Sep28144424@arolla.idiap.ch> <annius.717696151@freyr> <farrell.718005712@coral> <BvHIwz.9HM@comp.vuw.ac.nz> Date: 4 Oct 92 23:38:51 GMT Lines: 41