
Jon Fairbairn
On Fri, 16 Feb 2001, Scott Turner wrote:
Just because the type system of C keeps store implicit, it doesn't change the match between the meaning of 'return' in the two languages.
Or to put it another way, _all_ types in C are IO something. I think from a didactic point of view making this observation could be very valuable.
I absolutely agree. The Haskell foo :: IO Int foo = return 42 and C int foo () { return 42; } are exactly the same. It is bar = 42 for which C has no corresponding phrase. So, it is a new concept, which for the students - not surprisingly - is an intellectual challenge. In fact, I think, there is a second lesson in the whole story, too: Syntax is just...well...syntax. Students knowing only one or possibly two related languages, often cannot distinguish between syntax and semantics. Breaking their current, misguided model of programming languages is a first step for them towards gaining a deeper understanding. So, `return' is a feature, not a bug. I guess, the remedy for the course would be to provoke a discussion of the issue of C's return versus Haskell's return before the exam. Cheers, Manuel