On 4/17/07, skaller <[EMAIL PROTECTED]> wrote:
> I'm not sure I quite follow the argument. It is certainly
> possible to have higher order channels .. channels that
> you read channels off :)

Yep, that was all I was getting at.

> > Overall I like the idea but I disagree that it's any more modular than
> > a good functional programming language.  Functional module systems
> > such as O'Caml's really get to the heart of modularity: you can
> > manipulate both "ends" of a module functor the same way you can
> > manipulate the inputs and outputs of a chip.
>
> An example: folds and STL style iterators are control
> inverse. Iterators rock for users -- folds suck big time.
> Folds rock for implementors -- iterators suck for implementors.

Ah, I see what you're getting at; sorry, I thought you meant more on
the level of component manipulation, not control flow.  Suddenly your
comment about "switch spaghetti" makes a whole lot more sense :)

> This is where languages with call/cc or some other
> way of providing continuation passing natively shine.
> Unfortunately .. Ocaml isn't one of them, and it isn't
> lazy either. Laziness is closely related: eg a list
> comprehension = lazy list is actually a stream
> and provides a functional wrapper which hides the
> cooperative 'yield'.

Well, O'Caml does have streams... but even then you're forced to route
the control through a function, since there's no way to get at the
current continuation.

I presume Python's generators meet your requirements?  They were one
of the few features I greatly missed when switching to O'Caml from
Python.

I always thought though that there should be a way to multithread
generators... i.e., allow the generator, after a yield, to continue
running in parallel with the calling code, and buffer X values.
Disregarding the fact that Python has a global interpreter lock, you
could achieve this by having one function which runs in a separate
thread and continually fills a queue with values from the generator,
and another function which is a generator that yields values from the
queue (and blocks if the queue is empty).

Certainly you can do the same thing in Felix, and because Felix
doesn't have a silly global lock the generator would actually run in
parallel with the calling code; what's more, you could abstract this
to run across the network...

I think you're on to something good here :)

- Chris

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to