3 ms·
Continuations sound confusing because they give you an explicit handle for something that most languages don't let you reference directly: who gets the result o
by silentbicycle 17y ago
Continuations sound confusing because they give you an explicit handle for something that most languages don't let you reference directly: who gets the result of the current computation.
Are you familiar with setjmp/longjmp in C? Continuations are similar, but allow longjmp-ing to the same point multiple times. As you might expect, this gives you a lot of flexibility in defining control constructs.
You can implement exceptions easily via continuations - pass along an alternative continuation to receive errors. Continuations are more general than exceptions, backtracking, co-routining, etc., but this generality can make them seem overly abstract - it can be hard to see what those constructs have in common.
Hey, and don't worry - I started with BASIC too. (I was five or six.) You gotta start somewhere. After you feel comfortable with continuations, try learning about unification. :)
- eru 17y ago> Continuations sound confusing because they give you an explicit handle for something that most languages don't let you reference directly: who gets the result of the current computation. Yes, unfortunately continuations don't play nice with lazy evaluation.
- cousin_it 17y agoHow about this? http://www.haskell.org/all_about_monads/html/contmonad.html http://www.haskell.org/all_about_monads/html/contmonad.html
- eru 17y agoYes, I know about the continuation monad. But that continuations have to be encapsulated in monads is telling. I have found a discussion about this http://lambda-the-ultimate.org/classic/message10560.html http://lambda-the-ultimate.org/classic/message10560.html
- Vivtek 17y agoNow, unification (and matching in general) I get. That's magic on a level my mind can accept. Also: I envy you your starting at 5 or 6. My parents unfortunately couldn't afford the PDP-11 that would have required in my case.
- silentbicycle 17y agoI had a Commodore-64 and a library card. I was born in '82, though. Anyway, my point was that Dijkstra's just being a grouchypants when he says that BASIC permanently ruins people's minds for programming. Not even C++ could do that.
- eru 17y agoYes. And at least BASIC doesn't give you the illusion of a "powerful language".