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 subject altogether :-)
In the latter case, they are learning something useful. In the former case, the confusion emerges out of a useless property of the language. Let the students use {;} if it eliminates confusion, it's still perfectly good Haskell. 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. -- Ashley Yakeley, Seattle WA
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 indentation is often sloppy, and since layout is not enforced by the compiler I find it harder to read. I think it is largely a matter of taste. Martin's point is well taken, though. I think the redundancy can be useful for beginners. I suspect it's more the ; than the {} that makes it somewhat easier for beginners. -- Lennart
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 the layout first I would have had less trouble. I did notice that the error messages generated by incorrect layout don't offer much clue to the origin of the layout error, well from a beginner's interpretation of the error messages anyway. Having said that, now that I have gotten used to the Haskell layout I simply adore it. I often remember tiredly coding in C and relying on the compiler to locate where i had left out a ';' at the end of a statement or two. With Haskell there is no such need! Tuong, a happy haskell student..
participants (3)
-
Ashley Yakeley -
Han Tuong Hau -
Lennart Augustsson