caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "David McClain" <barabh@qwest.net>
To: <caml-list@inria.fr>
Subject: Re: [Caml-list] Error Reporting
Date: Fri, 28 Sep 2001 09:41:00 -0700	[thread overview]
Message-ID: <003701c1483c$5d17c100$210148bf@dylan> (raw)
In-Reply-To: <20010928172428.A28073@cs.uu.nl>

> There must be a past history, or otherwise you would not be able to
implement
> function application.

I must confess that I don't understand this statement...

Let's take a trivial example of a sequence of 3 "primitive" operations -- a
primitive operation being one which cannot make use of a continuation
argument.

Normal OCaml syntax for such a function would be:

let seqFn () =
    aFn ();
    bFn ();
    cFn ()

Now rewrite this in CPS style:

let seqFn () kont =
  let aPart kont' =
     aFn ();
     kont' ()
  in
  let bPart kont' =
     bFn ();
     kont' ()
  in
  let cPart kont' =
     aFn ();
     kont' ()
  in
    aPart kont

Here you see that all continuations are executed as tail jumps without
leaving an audit trail of history. Each subfunction stands alone and knows
nothing of the others. All any of them know is what they must do for their
part, and what continuation to jump to to finish up the program.

So now, if an error occurs in any of these inner closures, how will they be
able to report the chain of events leading to their execution?

But I suppose you are hinting that the compiler knows that all three of
these closures are contained in the outermost one and so some record of
activation history could be maintained by the compiler secretly plating
static linkage information into each sub-closure. Not a bad idea! It
certainly beats runtime computation of dynamic linkage and storing all that
in a history queue.

Thanks,

- DM



----- Original Message -----
From: "Frank Atanassow" <franka@cs.uu.nl>
To: "David McClain" <barabh@qwest.net>
Cc: <caml-list@inria.fr>
Sent: Friday, September 28, 2001 8:24 AM
Subject: Re: [Caml-list] Error Reporting


> David McClain wrote (on 27-09-01 13:36 -0700):
> > In a tail call, and all continuations are tail calls, there is no record
of
> > past history -- hence no trail of continuation frames. I can easily
report
> > the location of the present error, but there is no history to report.
>
> There must be a past history, or otherwise you would not be able to
implement
> function application.
>
> Let's make a distinction between continuations and tail calls. Really, it
> sounds like you are only _representing_ continuations in the source
language
> as tail calls in the target language. So in the target language, the two
are
> identified, but when you are compiling the source, you know which
> continuations are tail-recursive calls in the source language, and which
are
> only functional returns. In the code you emit, i.e., in the target
> language, you can thus distinguish these two types of continuations, and
when an
> error occurs, traverse the continuations which represent functional
returns,
> which should eventually lead to the prime mover, the entire program's
> continuation.
>
> --
> Frank Atanassow, Information & Computing Sciences, Utrecht University
> Padualaan 14, PO Box 80.089, 3508 TB Utrecht, Netherlands
> Tel +31 (030) 253-3261 Fax +31 (030) 251-379
> -------------------
> Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ:
http://caml.inria.fr/FAQ/
> To unsubscribe, mail caml-list-request@inria.fr  Archives:
http://caml.inria.fr
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-09-30 20:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-27 13:32 Krishnaswami, Neel
2001-09-27 20:36 ` David McClain
2001-09-28 15:24   ` Frank Atanassow
2001-09-28 16:41     ` David McClain [this message]
2001-09-27 22:34 ` David McClain
  -- strict thread matches above, loose matches on Subject: below --
2001-09-28 16:49 David McClain
2001-10-01  0:52 ` John Prevost
2001-10-01 14:17 ` Frank Atanassow
2001-10-01 15:44   ` David McClain
2001-09-27 13:00 Damien Doligez
2001-09-26 22:55 David McClain

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='003701c1483c$5d17c100$210148bf@dylan' \
    --to=barabh@qwest.net \
    --cc=caml-list@inria.fr \
    /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).