Re: layout rule infelicity

2002-05-31 Thread Ketil Z. Malde
Jon Fairbairn <[EMAIL PROTECTED]> writes: > Why "-f" anyway? It took me ages to work out what > "-fallow-overlapping-instances" meant -- I wondered how > "fallow" could apply to overlapping instances. I suppose it's a GCCism, where options starting with -f specifiy *f*lags. (Which doesn't seem

Re: layout rule infelicity

2002-05-30 Thread Alexander V. Voinov
Hi All, Andrew J Bromage wrote: > > G'day all. > > On Thu, May 30, 2002 at 01:10:03PM +0200, Johannes Waldmann wrote: > > > Python has it as well (they stole it from Haskell?) > > Python's layout rule looks more like Occam's than Haskell's, to my eyes. > > Aside: Was Occam the first language

Re: layout rule infelicity

2002-05-30 Thread Andrew J Bromage
G'day all. On Thu, May 30, 2002 at 01:10:03PM +0200, Johannes Waldmann wrote: > Python has it as well (they stole it from Haskell?) Python's layout rule looks more like Occam's than Haskell's, to my eyes. Aside: Was Occam the first language of the post-punched-card era to use layout as syntax?

Re: layout rule infelicity

2002-05-30 Thread Jon Fairbairn
I wrote: > > Can someone remind me why the "A close brace is also inserted whenever > > the syntactic category containing the layout list ends" part > > of the rule is there? Lennart wrote: > It's so you can write > let x = 2+2 in x*x > (and similar things) and Arjan van IJzendoorn wrote:

Re: layout rule infelicity

2002-05-30 Thread George Russell
Jon Fairbairn wrote [snip] > Well, there's two things to consider: Haskell 98, which > probably shouldn't change, and extended Haskell, which > probably should. Especially if we can make the rules both > simpler and better. [snip] How can I resist? I proposed the following revised layout rule som

Re: layout rule infelicity

2002-05-30 Thread Arjan van IJzendoorn
> Can someone remind me why the "A close brace is also inserted whenever > the syntactic category containing the layout list ends" part > of the rule is there? x = (3, case True of True -> 4) The ')' ends the syntactic category 'tuple' Arjan _

Re: layout rule infelicity

2002-05-30 Thread Lennart Augustsson
Jon Fairbairn wrote: > > I wasn't fit enough to follow the earlier discussions of the > layout rule, so I'm not sure how this interacts with > previous awkward cases. I'd be happiest if we could come up > with a rule that didn't involve sticking in braces and > semicolons because it won't parse

Re: layout rule infelicity

2002-05-30 Thread Jon Fairbairn
> I like layout but I think the existing rules are too > complicated. Unfortunat ely it's difficult to do anything > with them without breaking vast swathes of existing code, > so we'll just have to put up with them. Well, there's two things to consider: Haskell 98, which probably shouldn't chan

Re: layout rule infelicity

2002-05-30 Thread Han Tuong Hau
Hi everyone, I thought I would bring a students perspective into this discussion. Moving from a C background to Haskell, the layout wasn't very intuitive at first. This was mainly due to my hand's on approach (looking at examples and trying to code similar programs). Given that if i read up on th

Re: layout rule infelicity

2002-05-30 Thread Lennart Augustsson
Ashley Yakeley wrote: > I am certainly not proposing Haskell be modified to eliminate the layout > option. I'm just curious as to why Haskell programmers choose to use it. Because I find programs using layout to be more readable. In Haskell (not in C) programs using {;} I've found that the inden

Re: layout rule infelicity

2002-05-30 Thread Ashley Yakeley
At 2002-05-30 03:59, Ketil Z. Malde wrote: >Short answer: What's wrong with it is that humans use layout to infer >the semantic meaning, No... layout by itself can't be trusted. It's only a clue. One needs to learn the precise Haskell-specific layout rules, and they're not obvious. -- Ashley

Re: layout rule infelicity

2002-05-30 Thread Ashley Yakeley
At 2002-05-30 04:19, Johannes Waldmann wrote: >same here, for exactly these reasons. students get really confused. > >on the other hand, students regularily get confused by other things as well, >like homework assignments on formal languages, >so that alone is not enough reason to drop the subjec

Re: layout rule infelicity

2002-05-30 Thread Ashley Yakeley
At 2002-05-30 04:10, Johannes Waldmann wrote: >ghc -Wall warns nicely about undeclared top-level types but what about >locals? You'd have to declare them in terms of the top-level types, i.e. other type annotations. I think GHC allows some form of this, but IIRC it's a bit tricky. If it were

Re: layout rule infelicity

2002-05-30 Thread Johannes Waldmann
> ... layout rules somewhat > like Haskell's. In our experience it was the single thing that > confused students most. same here, for exactly these reasons. students get really confused. on the other hand, students regularily get confused by other things as well, like homework assignments on for

Re: layout rule infelicity

2002-05-30 Thread Johannes Waldmann
> What's the deal with the whole "layout" thing anyway? I've never come > across it before in another language. Python has it as well (they stole it from Haskell?) > If I were teaching Haskell to "working programmer" types like myself, I > would encourage them to always use full semicolons and

Re: layout rule infelicity

2002-05-30 Thread Ketil Z. Malde
Martin Odersky <[EMAIL PROTECTED]> writes: > Redundancy maybe? What's wrong in having both layout and punctuation? Short answer: What's wrong with it is that humans use layout to infer the semantic meaning, compilers use punctuation. Thus it's not really redundancy. -kzm -- If I haven't seen

Re: layout rule infelicity

2002-05-30 Thread George Russell
I like layout but I think the existing rules are too complicated. Unfortunately it's difficult to do anything with them without breaking vast swathes of existing code, so we'll just have to put up with them. The reason I think layout is better than using {'s and ,'s is that humans use the layout

Re: layout rule infelicity

2002-05-30 Thread Martin Odersky
> If you look at C (& offspring), it's not the {;} that makes the code > readable, it's the indentation that does. So why not acknowledge that? Redundancy maybe? What's wrong in having both layout and punctuation? For instance, then you can have an emacs mode that handles the layout given the

Re: layout rule infelicity

2002-05-30 Thread Ashley Yakeley
At 2002-05-30 02:54, Lennart Augustsson wrote: >If you look at C (& offspring), it's not the {;} that makes the code >readable, it's the indentation that does. So why not acknowledge that? In C, the indentation is an important visual clue, but there are many different indentation styles. It's

Re: layout rule infelicity

2002-05-30 Thread D. Tweed
On Thu, 30 May 2002, Ashley Yakeley wrote: > it). Certainly I find {;} more readable, and I suspect anyone else with a > C/C++/Java background (or even a Scheme/Lisp background) does too. Just a data point: I learned Basic, Pascal, Standard ML, C, Haskell, C++, Perl, Python in that order and ac

Re: layout rule infelicity

2002-05-30 Thread Lennart Augustsson
Ashley Yakeley wrote: > At 2002-05-30 02:26, Jon Fairbairn wrote: > > >I think this is extremely bad language design! In general I > >like having layout rules, but > ... > > What's the deal with the whole "layout" thing anyway? I've never come > across it before in another language. Is it an acad

Re: layout rule infelicity

2002-05-30 Thread Ashley Yakeley
At 2002-05-30 02:46, I wrote: >What's the deal with the whole "layout" thing anyway? I've never come >across it before in another language. Oh, wait, there's Python and Ruby. For some reason it doesn't bother me so much with them. -- Ashley Yakeley, Seattle WA __

Re: layout rule infelicity

2002-05-30 Thread Ashley Yakeley
At 2002-05-30 02:26, Jon Fairbairn wrote: >I think this is extremely bad language design! In general I >like having layout rules, but ... What's the deal with the whole "layout" thing anyway? I've never come across it before in another language. Is it an academic thing? It drove me nuts when I

layout rule infelicity

2002-05-30 Thread Jon Fairbairn
Two very similar programmmes: > possible_int = do skip_blanks > fmap Just int >+++ (literal "-" `as` Nothing) > possible_int = do skip_blanks > fmap Just int > +++ (literal "-" `as` Nothing) I think this is extremely ba