caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: oleg@pobox.com
Cc: psnively@mac.com, caml-list@inria.fr
Subject: Re: [Caml-list] Incremental, undoable parsing in OCaml as the general parser inversion
Date: Thu, 05 Jul 2007 23:23:11 +1000	[thread overview]
Message-ID: <1183641791.12890.57.camel@rosella.wigram> (raw)
In-Reply-To: <20070705081338.D090BAD43@Adric.metnet.fnmoc.navy.mil>

On Thu, 2007-07-05 at 01:13 -0700, oleg@pobox.com wrote:

> The beauty of delimited continuations is that we take any function
> that accepts some kind of `callback' and pass a specifically
> constructed callback (which is essentially shift f f). Thus we have
> accomplished inversion. The function in question can be a map-like
> traversal combinator (the callback is the function to map), a parser
> (the callback here is the stream, the function that provides data to
> the parser), a GUI system with its own event loop, etc.

Unfortunately what you need for a GUI is not control
inverting the callback -- programmers in industry do that
every day: it's an extremely common task.

Of course the way they do it is naive and laborious.

But it isn't the real problem.. it's the GUI event loop
that needs to be inverted.

Luckily that can be done for both X- and MS- Windows by
the simple expedient of not writing an event loop in the
first place!! In both systems, there is no event loop.
The API provides a function to read the message queue --
writing an event loop is the users job .. so inverting
it is easy .. just don't write it!

Unfortunately .. doing that throws away all the GUI toolkits
out there -- GTK is gone, for example. They were all written
the wrong way ..

Rewriting GTK in a monadic style is not going to be
so easy .. it's rather a lot of code and much of the
interface is *based* on the standard C model, where
continuations are passed by pushing the return address
implicitly onto the machine stack.

Luckily .. most of the work done in a GUI tool kit can be
done much better using Open GL anyhow .. and OpenGL is
algorithmic not event driven. In particular SDL is
also algorithmic, not even driven.

So .. if you really want to invert GTK .. you are left
with the system supported control inversion device,
which is more or less universal and works with some
C code at least .. Posix threads.

After all the *primary* job of an operating system
is precisely control inversion.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  parent reply	other threads:[~2007-07-05 13:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-03 11:38 oleg
2007-07-03 15:28 ` [Caml-list] " skaller
2007-07-04 19:41 ` Paul Snively
2007-07-04 23:42   ` Paul Snively
2007-07-05  8:13     ` oleg
2007-07-05 12:39       ` skaller
2007-07-05 23:00         ` [Caml-list] Incremental, undoable parsing in OCaml as the oleg
2007-07-06  4:40           ` skaller
2007-07-05 13:23       ` skaller [this message]
2007-07-05 13:54       ` [Caml-list] Incremental, undoable parsing in OCaml as the general parser inversion Paul Snively

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1183641791.12890.57.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    --cc=oleg@pobox.com \
    --cc=psnively@mac.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).