Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] [ANN] The Missing Library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-29 (01:03)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] [ANN] The Missing Library
On Thu, 2004-04-29 at 04:42, Jon Harrop wrote:

> Oh my God, you're not seriously advocating a page of gotos over that are you?

Certainly: its a state machine, that's how the work,
you can't get around that.

However the goto's aren't of consequence here.
I you wanted you could use a for loop, or
whatever .. 

> I think you can easily have it either way in ocaml too. For the imperative 
> style you can use map or iter with a function which has side-effects on some 
> more global state. For the functional approach you use fold and pass the 
> state on each time.

You are missing the point. Neither solution control inverts.
So they're both weak. In the control inverted solution
you aren't not called with some state, you do the calling
so you can use for example let/bindings and recursion
to maintain state "functionally": you cannot do that
with the callback driven model, you're forced to use
mutable state.

In practice not all complex problems admit
a clean solution using functional states,
you may need some variables too. But at least
you can reduce the need to use it if you have
control inversion built into your language.

Sure like to see a monadic/lazy solution to
the example using streams ..

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: