unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Alex Shinn <alexshinn@gmail.com>, cowan <cowan@ccil.org>
Cc: guile-devel@gnu.org
Subject: Mistakes in the R7RS-small formal denotational semantics
Date: Tue, 20 Jun 2017 22:45:22 -0400	[thread overview]
Message-ID: <87podykqil.fsf@netris.org> (raw)

Hi Alex and John,

I believe I've found a few mistakes in the formal denotational semantics
for R7RS-small.  The scheme-reports mailing list seems to be gone, so
I'm not sure where to send this.

First, if I understand correctly, the 'pathup' and 'pathdown' auxiliary
functions associate the wrong dynamic point with each before/after
thunk.  In 'pathup', the first element of the result sequence:

  <(ω₁,ω₁|(F×F×P)↓2)>

should be:

  <(ω₁|(F×F×P)↓3,ω₁|(F×F×P)↓2)>

and similarly, in 'pathdown', the final element of the result sequence:

  <(ω₂,ω₂|(F×F×P)↓1)>

should be:

  <(ω₂|(F×F×P)↓3,ω₂|(F×F×P)↓1)>

These changes are needed to match the english description of
'dynamic-wind' in R7RS, which says "The before and after thunks are
called in the same dynamic environment as the call to 'dynamic-wind'".

They are also needed for consistency with the 'dynamicwind' auxiliary
function, which calls the before and after thunks in accordance with the
english specification during the normal code path through 'dynamic-wind'
(e.g. when call/cc is not used).

Because of the mistakes above, the current R7RS formal semantics specify
that the before and after thunks, when called implicitly by invoking a
first-class continuation, are called in the same dynamic environment as
the call to the inner thunk of 'dynamic-wind'.

Another problem: 'travelpath' contains a type error.  ((π*↓1)↓2) has
type F (a procedure value), but what's needed in that context is the
second member of F, which has type E* -> P -> K -> C.  The easiest fix
would be to insert 'applicate' before ((π*↓1)↓2).

These mistakes were inherited from the paper "How to Add Threads to a
Sequential Language Without Getting Tangled Up" by Gasbichler, Knauel,
Sperber and Kelsey.

I also found a mistake that was apparently inherited from R5RS: in
'cwv', the final call to 'applicate' is missing its continuation
argument κ.

     Regards,
       Mark



             reply	other threads:[~2017-06-21  2:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21  2:45 Mark H Weaver [this message]
2017-06-21 12:14 ` Mistakes in the R7RS-small formal denotational semantics John Cowan

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=87podykqil.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=alexshinn@gmail.com \
    --cc=cowan@ccil.org \
    --cc=guile-devel@gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).