mirror of
https://github.com/dhil/phd-dissertation
synced 2026-04-30 07:56:30 +01:00
Compare commits
30 Commits
d7bd881a00
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2d79e1d06 | ||
|
|
47410e4d14 | ||
| 81a4ecec0b | |||
| cafa8b1ba2 | |||
| 2e61275a5b | |||
| e90ba67a4b | |||
| 6aee80a71b | |||
| aea67c86b4 | |||
|
|
5ede30903f | ||
|
|
03b7c5b548 | ||
| 7535fe7ecc | |||
| 72b54ad278 | |||
| 01e707822f | |||
| 2cecb13d34 | |||
| ed634fcaa3 | |||
| c60dc80fde | |||
| e86597f4e4 | |||
| 2b7b1df8db | |||
| 20f44ad547 | |||
| 101ac96aa2 | |||
| e6182105de | |||
| 63fe9a738a | |||
| 3a9394baf8 | |||
| 6193214890 | |||
| ffe6ebd0b9 | |||
| 01a8a3d581 | |||
| 008e80ea67 | |||
| 3276537ab1 | |||
| 20551152b3 | |||
| 8679803146 |
134
README.md
134
README.md
@@ -1,16 +1,13 @@
|
|||||||
# Foundations for programming and implementing effect handlers
|
# Foundations for programming and implementing effect handlers
|
||||||
|
|
||||||
**NOTE** I have made a draft copy of the dissertation available in
|
A copy of my dissertation can be [downloaded via my
|
||||||
this repository. I ask that you **do not** link to or distribute the
|
website](https://dhil.net/research/papers/thesis.pdf).
|
||||||
draft anywhere, because I will delete the file once the final revision
|
|
||||||
has been submitted after the viva. I will make the final revision
|
|
||||||
publicly available at a stable link.
|
|
||||||
|
|
||||||
---
|
----
|
||||||
|
|
||||||
Submitted May 30, 2021. Viva August 13, 2021.
|
Submitted on May 30, 2021. Examined on August 13, 2021.
|
||||||
|
|
||||||
The board of examiners consists of
|
The board of examiners were
|
||||||
|
|
||||||
* [Andrew Kennedy](https://github.com/andrewjkennedy) (Facebook London)
|
* [Andrew Kennedy](https://github.com/andrewjkennedy) (Facebook London)
|
||||||
* [Edwin Brady](https://www.type-driven.org.uk/edwinb/) (University of St Andrews)
|
* [Edwin Brady](https://www.type-driven.org.uk/edwinb/) (University of St Andrews)
|
||||||
@@ -30,77 +27,76 @@ The dissertation is structured as follows.
|
|||||||
and contributions of the dissertation, and discusses some related
|
and contributions of the dissertation, and discusses some related
|
||||||
work.
|
work.
|
||||||
|
|
||||||
### Background
|
|
||||||
|
|
||||||
* Chapter 2 defines some basic mathematical notation and
|
|
||||||
constructions that are they pervasively throughout this dissertation.
|
|
||||||
|
|
||||||
* Chapter 3 presents a literature survey of continuations and
|
|
||||||
first-class control. I classify continuations according to their
|
|
||||||
operational behaviour and provide an overview of the various
|
|
||||||
first-class sequential control operators that appear in the
|
|
||||||
literature. The application spectrum of continuations is discussed as
|
|
||||||
well as implementation strategies for first-class control.
|
|
||||||
|
|
||||||
### Programming
|
### Programming
|
||||||
|
|
||||||
* Chapter 4 introduces a polymorphic fine-grain call-by-value core
|
* Chapter 2 illustrates effect handler oriented programming by
|
||||||
calculus, λ<sub>b</sub>, which makes key use of Remy-style row polymorphism
|
example by implementing a small operating system dubbed Tiny UNIX,
|
||||||
to implement polymorphic variants, structural records, and a
|
which captures some essential traits of Ritchie and Thompson's
|
||||||
structural effect system. The calculus distils the essence of the core
|
UNIX. The implementation starts with a basic notion of file i/o,
|
||||||
of the Links programming language.
|
and then, it evolves into a feature-rich operating system with full
|
||||||
|
file i/o, multiple user environments, multi-tasking, and more, by
|
||||||
|
composing ever more effect handlers.
|
||||||
|
|
||||||
* Chapter 5 presents three extensions of λ<sub>b</sub>,
|
* Chapter 3 introduces a polymorphic fine-grain call-by-value core
|
||||||
which are λ<sub>h</sub> that adds deep handlers, λ<sup>†</sup> that adds shallow
|
calculus, λ<sub>b</sub>, which makes key use of Rémy-style row
|
||||||
handlers, and λ<sup>‡</sup> that adds parameterised handlers. The chapter
|
polymorphism to implement polymorphic variants, structural records,
|
||||||
also contains a running case study that demonstrates effect handler
|
and a structural effect system. The calculus distils the essence of
|
||||||
oriented programming in practice by implementing a small operating
|
the core of the Links programming language. The chapter also
|
||||||
system dubbed Tiny UNIX based on Ritchie and Thompson's original
|
presents three extensions of λ<sub>b</sub>, which are λ<sub>h</sub>
|
||||||
UNIX.
|
that adds deep handlers, λ<sup>†</sup> that adds shallow handlers,
|
||||||
|
and λ<sup>‡</sup> that adds parameterised handlers.
|
||||||
|
|
||||||
### Implementation
|
### Implementation
|
||||||
|
|
||||||
* Chapter 6 develops a higher-order continuation passing
|
* Chapter 4 develops a higher-order continuation passing style
|
||||||
style translation for effect handlers through a series of step-wise
|
translation for effect handlers through a series of step-wise
|
||||||
refinements of an initial standard continuation passing style
|
refinements of an initial standard continuation passing style
|
||||||
translation for λ<sub>b</sub>. Each refinement slightly modifies the notion
|
translation for λ<sub>b</sub>. Each refinement slightly modifies
|
||||||
of continuation employed by the translation. The development
|
the notion of continuation employed by the translation. The
|
||||||
ultimately leads to the key invention of generalised continuation,
|
development ultimately leads to the key invention of generalised
|
||||||
which is used to give a continuation passing style semantics to deep,
|
continuation, which is used to give a continuation passing style
|
||||||
shallow, and parameterised handlers.
|
semantics to deep, shallow, and parameterised handlers.
|
||||||
|
|
||||||
* Chapter 7 demonstrates an application of generalised continuations
|
* Chapter 5 demonstrates an application of generalised continuations
|
||||||
to abstract machine as we plug generalised continuations into
|
to abstract machine as we plug generalised continuations into
|
||||||
Felleisen and Friedman's CEK machine to obtain an adequate abstract
|
Felleisen and Friedman's CEK machine to obtain an adequate abstract
|
||||||
runtime with simultaneous support for deep, shallow, and parameterised
|
runtime with simultaneous support for deep, shallow, and
|
||||||
handlers.
|
parameterised handlers.
|
||||||
|
|
||||||
### Expressiveness
|
### Expressiveness
|
||||||
* Chapter 8 shows that deep, shallow, and parameterised notions of
|
|
||||||
handlers can simulate one another up to specific notions of
|
|
||||||
administrative reduction.
|
|
||||||
|
|
||||||
* Chapter 9 studies the fundamental efficiency of effect handlers. In
|
* Chapter 6 shows that deep, shallow, and parameterised notions of
|
||||||
this chapter, we show that effect handlers enable an asymptotic
|
handlers can simulate one another up to specific notions of
|
||||||
improvement in runtime complexity for a certain class of
|
administrative reduction.
|
||||||
functions. Specifically, we consider the *generic count* problem using
|
|
||||||
a pure PCF-like base language λ<sub>b</sub><sup>→</sup> (a simply typed variation of
|
* Chapter 7 studies the fundamental efficiency of effect handlers. In
|
||||||
λ<sub>b</sub>) and its extension with effect handlers λ<sub>h</sub><sup>→</sup>. We
|
this chapter, we show that effect handlers enable an asymptotic
|
||||||
show that λ<sub>h</sub><sup>→</sup> admits an asymptotically more efficient
|
improvement in runtime complexity for a certain class of
|
||||||
implementation of generic count than any λ<sub>b</sub><sup>→</sup> implementation.
|
functions. Specifically, we consider the *generic count* problem
|
||||||
|
using a pure PCF-like base language λ<sub>b</sub><sup>→</sup> (a
|
||||||
|
simply typed variation of λ<sub>b</sub>) and its extension with
|
||||||
|
effect handlers λ<sub>h</sub><sup>→</sup>. We show that
|
||||||
|
λ<sub>h</sub><sup>→</sup> admits an asymptotically more efficient
|
||||||
|
implementation of generic count than any λ<sub>b</sub><sup>→</sup>
|
||||||
|
implementation.
|
||||||
|
|
||||||
### Conclusions
|
### Conclusions
|
||||||
* Chapter 10 concludes and discusses future work.
|
* Chapter 8 concludes and discusses future work.
|
||||||
|
|
||||||
### Appendices
|
### Appendices
|
||||||
* Appendix A contains a proof that shows the `Get-get` equation for
|
|
||||||
state is redundant.
|
* Appendix A contains a literature survey of continuations and
|
||||||
* Appendix B contains the proof details for the higher-order
|
first-class control. I classify continuations according to their
|
||||||
uncurried CPS translation for deep and shallow handlers.
|
operational behaviour and provide an overview of the various
|
||||||
* Appendix C contains the proof details and gadgetry for the
|
first-class sequential control operators that appear in the
|
||||||
complexity of the effectful generic count program.
|
literature. The application spectrum of continuations is discussed
|
||||||
* Appendix D provides a sample implementation of the Berger count
|
as well as implementation strategies for first-class control.
|
||||||
program and discusses it in more detail.
|
* Appendix B contains a proof that shows the `Get-get` equation for
|
||||||
|
state is redundant.
|
||||||
|
* Appendix C contains the proof details and gadgetry for the
|
||||||
|
complexity of the effectful generic count program.
|
||||||
|
* Appendix D provides a sample implementation of the Berger count
|
||||||
|
program and discusses it in more detail.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
@@ -114,3 +110,11 @@ e.g.
|
|||||||
$ make
|
$ make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Timeline
|
||||||
|
|
||||||
|
I submitted my thesis on May 30, 2021. It was examined on August 13,
|
||||||
|
2021, where I received pass with minor corrections. The revised thesis
|
||||||
|
was submitted on December 22, 2021. It was approved on March
|
||||||
|
14, 2022. The final revision was submitted on March 23, 2022. I
|
||||||
|
received my PhD award letter on March 24, 2022. My graduation
|
||||||
|
ceremony took place in McEwan Hall on July 11, 2022.
|
||||||
|
|||||||
1469
code/ehop2022.links
Normal file
1469
code/ehop2022.links
Normal file
File diff suppressed because it is too large
Load Diff
1352
code/unix-huawei2022.links
Normal file
1352
code/unix-huawei2022.links
Normal file
File diff suppressed because it is too large
Load Diff
1372
code/unix-msr2022.links
Normal file
1372
code/unix-msr2022.links
Normal file
File diff suppressed because it is too large
Load Diff
1352
code/unix-nuprl2022.links
Normal file
1352
code/unix-nuprl2022.links
Normal file
File diff suppressed because it is too large
Load Diff
1393
code/unix-tutorial.links
Normal file
1393
code/unix-tutorial.links
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1258,7 +1258,7 @@
|
|||||||
|
|
||||||
@techreport{Remy93,
|
@techreport{Remy93,
|
||||||
title = {{Syntactic theories and the algebra of record terms}},
|
title = {{Syntactic theories and the algebra of record terms}},
|
||||||
author = {Didier Remy},
|
author = {Didier R\'{e}my},
|
||||||
number = {RR-1869},
|
number = {RR-1869},
|
||||||
institution = {{INRIA}},
|
institution = {{INRIA}},
|
||||||
year = {1993},
|
year = {1993},
|
||||||
@@ -2401,7 +2401,8 @@
|
|||||||
author = {Nikolaos S. Papspyrou},
|
author = {Nikolaos S. Papspyrou},
|
||||||
title = {A resumption monad transformer and its applications in the semantics of concurrency},
|
title = {A resumption monad transformer and its applications in the semantics of concurrency},
|
||||||
booktitle = {Proceedings of the 3rd Panhellenic Logic Symposium},
|
booktitle = {Proceedings of the 3rd Panhellenic Logic Symposium},
|
||||||
address = {Anogia, Greece}
|
address = {Anogia, Greece},
|
||||||
|
year = 2001,
|
||||||
}
|
}
|
||||||
|
|
||||||
@inproceedings{Harrison06,
|
@inproceedings{Harrison06,
|
||||||
|
|||||||
102
thesis.tex
102
thesis.tex
@@ -167,7 +167,7 @@
|
|||||||
%
|
%
|
||||||
Effect handlers provide a particularly structured approach to
|
Effect handlers provide a particularly structured approach to
|
||||||
programming with first-class control by naming control reifying
|
programming with first-class control by naming control reifying
|
||||||
operations and separating from their handling.
|
operations and separating them from their handling.
|
||||||
|
|
||||||
This thesis is composed of three strands of work in which I develop
|
This thesis is composed of three strands of work in which I develop
|
||||||
operational foundations for programming and implementing effect
|
operational foundations for programming and implementing effect
|
||||||
@@ -313,32 +313,33 @@
|
|||||||
about my work.
|
about my work.
|
||||||
%
|
%
|
||||||
Thirdly, I want to thank my academic brother Simon Fowler, who has
|
Thirdly, I want to thank my academic brother Simon Fowler, who has
|
||||||
always been a good friend and a pillar of inspiration. Regardless of
|
always been a good and inspirational friend. Regardless of academic
|
||||||
academic triumphs and failures, we have always had fun.
|
triumphs and failures, we have always had fun.
|
||||||
|
|
||||||
I am extremely grateful to KC Sivaramakrishnan, who took a genuine
|
I am extremely grateful to KC Sivaramakrishnan, who took a genuine
|
||||||
interest in my research early on and invited me to come spend some
|
interest in my research early on and invited me to come spend some
|
||||||
time at OCaml Labs in Cambridge. My initial visit to Cambridge
|
time at OCaml Labs in Cambridge. My initial visit to Cambridge
|
||||||
sparked the beginning of a long-standing and productive
|
sparked the beginning of a long-standing and productive
|
||||||
collaboration. Also, thanks to Gemma Gordon, who I had the pleasure
|
collaboration. Also, thanks to Gemma Gordon, who I have had the
|
||||||
of sharing an office with during one of my stints at OCaml Labs.
|
pleasure of sharing an office with during one of my stints at OCaml
|
||||||
|
Labs.
|
||||||
|
|
||||||
I have been fortunate to work with Robert Atkey, who has been a
|
I have been fortunate to work with Robert Atkey, who has been a
|
||||||
continuous source of inspiration and interesting research ideas. Our
|
continuous source of inspiration and interesting research ideas. Our
|
||||||
work is clearly reflected in this dissertation.
|
work is clearly reflected in this dissertation.
|
||||||
%
|
%
|
||||||
I also want to thank my other collaborators: Andreas Rossberg, Anil
|
I also want to thank to my other collaborators: Andreas Rossberg,
|
||||||
Madhavapeddy, Leo White, Stephen Dolan, and Jeremy Yallop.
|
Anil Madhavapeddy, Leo White, Stephen Dolan, and Jeremy Yallop.
|
||||||
|
|
||||||
I have had the pleasure of working in LFCS at the same time as James
|
I have had the pleasure of working in LFCS at the same time as James
|
||||||
McKinna. James has always taken a genuine interest in my work and
|
McKinna. James has always taken a genuine interest in my work and
|
||||||
challenged me with intellectually stimulating questions. I
|
challenged me with intellectually stimulating questions. I
|
||||||
appreciate our many conversations even though I spent days, weeks,
|
appreciate our many conversations even though I spent days, weeks,
|
||||||
sometimes months, and in some instances years to come up with
|
sometimes months, and in some instances years to come up with
|
||||||
adequate answers. I also want to thank other former and present
|
adequate answers. I also want to extend my thanks to other former
|
||||||
members of Informatics: Brian Campbell, Christophe Dubach, James
|
and present members of Informatics: Brian Campbell, Christophe
|
||||||
Cheney, J. Garrett Morris, Gordon Plotkin, Michel Steuwer, Philip
|
Dubach, James Cheney, J. Garrett Morris, Gordon Plotkin, Mary Cryan,
|
||||||
Wadler, and Stephen Gilmore.
|
Murray Cole, Michel Steuwer, and Philip Wadler.
|
||||||
|
|
||||||
My time as a student in Informatics Forum has been enjoyable in
|
My time as a student in Informatics Forum has been enjoyable in
|
||||||
large part thanks to my friends: Amna Shahab, Chris Vasiladiotis,
|
large part thanks to my friends: Amna Shahab, Chris Vasiladiotis,
|
||||||
@@ -348,10 +349,10 @@
|
|||||||
Ginsbach, Radu Ciobanu, Rajkarn Singh, Rosinda Fuentes Pineda, Rudi
|
Ginsbach, Radu Ciobanu, Rajkarn Singh, Rosinda Fuentes Pineda, Rudi
|
||||||
Horn, Shayan Najd, Stan Manilov, and Vanya Yaneva-Cormack.
|
Horn, Shayan Najd, Stan Manilov, and Vanya Yaneva-Cormack.
|
||||||
|
|
||||||
Thanks to Ohad Kammar for agreeing to be the internal examiner for
|
Thanks to Ohad Kammar and Stephen Gilmore for agreeing to serve as
|
||||||
my dissertation. As for external examiners, I am truly humbled and
|
the internal examiners for my dissertation. As for external
|
||||||
thankful for Andrew Kennedy and Edwin Brady agreeing to examine my
|
examiners, I am truly humbled and thankful for Andrew Kennedy and
|
||||||
dissertation.
|
Edwin Brady agreeing to examine my dissertation.
|
||||||
|
|
||||||
Throughout my studies I have received funding from the
|
Throughout my studies I have received funding from the
|
||||||
\href{https://www.ed.ac.uk/informatics}{School of Informatics} at
|
\href{https://www.ed.ac.uk/informatics}{School of Informatics} at
|
||||||
@@ -5445,7 +5446,7 @@ created by the operating system.
|
|||||||
%
|
%
|
||||||
\[
|
\[
|
||||||
\bl
|
\bl
|
||||||
\init : (\Unit \to \alpha \eff \varepsilon) \to \alpha \eff \{\Co;\varepsilon\}\\
|
\init : (\UnitType \to \UnitType \eff \varepsilon) \to \UnitType \eff \{\Co;\varepsilon\}\\
|
||||||
\init~main \defas
|
\init~main \defas
|
||||||
\bl
|
\bl
|
||||||
\Let\;pid \revto \Do\;\UFork~\Unit\;\In\\
|
\Let\;pid \revto \Do\;\UFork~\Unit\;\In\\
|
||||||
@@ -5534,10 +5535,11 @@ $\Fork : \UnitType \opto \Bool$, by $\timesharee$, which handles the
|
|||||||
more general operation $\UFork : \UnitType \opto \Int$. In practice,
|
more general operation $\UFork : \UnitType \opto \Int$. In practice,
|
||||||
we may be unable to dispense of the old interface so easily, meaning
|
we may be unable to dispense of the old interface so easily, meaning
|
||||||
we have to retain support for, say, legacy reasons. As we have seen
|
we have to retain support for, say, legacy reasons. As we have seen
|
||||||
previously we can an operation in terms of another operation. Thus to
|
previously we can interpret an operation in terms of another
|
||||||
retain support for $\Fork$ we simply have to insert a handler under
|
operation. Thus to retain support for $\Fork$ we simply have to insert
|
||||||
$\timesharee$ which interprets $\Fork$ in terms of $\UFork$. The
|
a handler under $\timesharee$ which interprets $\Fork$ in terms of
|
||||||
operation case of this handler would be akin to the following.
|
$\UFork$. The operation case of this handler would be akin to the
|
||||||
|
following.
|
||||||
%
|
%
|
||||||
\[
|
\[
|
||||||
\OpCase{\Fork}{\Unit}{resume} \mapsto
|
\OpCase{\Fork}{\Unit}{resume} \mapsto
|
||||||
@@ -5551,7 +5553,7 @@ The interpretation of $\Fork$ inspects the process identifier returned
|
|||||||
by the $\UFork$ to determine the role of the current process in the
|
by the $\UFork$ to determine the role of the current process in the
|
||||||
parent-child relationship. If the identifier is nonzero, then the
|
parent-child relationship. If the identifier is nonzero, then the
|
||||||
process is a parent, hence $\Fork$ should return $\True$ to its
|
process is a parent, hence $\Fork$ should return $\True$ to its
|
||||||
caller. Otherwise it should return $\False$. This preserves the
|
caller, and otherwise it should return $\False$, thus preserving the
|
||||||
functionality of the legacy code.
|
functionality of the legacy code.
|
||||||
|
|
||||||
\section{Related work}
|
\section{Related work}
|
||||||
@@ -6546,9 +6548,9 @@ Computations
|
|||||||
% Let
|
% Let
|
||||||
\inferrule*[Lab=\tylab{Let}]
|
\inferrule*[Lab=\tylab{Let}]
|
||||||
{\typc{\Delta;\Gamma}{M : A}{E} \\
|
{\typc{\Delta;\Gamma}{M : A}{E} \\
|
||||||
\typ{\Delta;\Gamma, x : A}{N : C}
|
\typc{\Delta;\Gamma, x : A}{N : B}{E}
|
||||||
}
|
}
|
||||||
{\typ{\Delta;\Gamma}{\Let \; x \revto M\; \In \; N : C}}
|
{\typc{\Delta;\Gamma}{\Let \; x \revto M\; \In \; N : B}{E}}
|
||||||
\end{mathpar}
|
\end{mathpar}
|
||||||
\caption{Typing rules}
|
\caption{Typing rules}
|
||||||
\label{fig:base-language-type-rules}
|
\label{fig:base-language-type-rules}
|
||||||
@@ -6672,7 +6674,7 @@ that the binder $x : A$.
|
|||||||
\EC[M] &\reducesto& \EC[N], \hfill\quad \text{if } M \reducesto N \\
|
\EC[M] &\reducesto& \EC[N], \hfill\quad \text{if } M \reducesto N \\
|
||||||
\end{reductions}
|
\end{reductions}
|
||||||
\begin{syntax}
|
\begin{syntax}
|
||||||
\slab{Evaluation contexts} & \mathcal{E} \in \EvalCat &::=& [~] \mid \Let \; x \revto \mathcal{E} \; \In \; N
|
\slab{Evaluation~contexts} & \mathcal{E} \in \EvalCat &::=& [~] \mid \Let \; x \revto \mathcal{E} \; \In \; N
|
||||||
\end{syntax}
|
\end{syntax}
|
||||||
%
|
%
|
||||||
%\dhil{Describe evaluation contexts as functions: decompose and plug.}
|
%\dhil{Describe evaluation contexts as functions: decompose and plug.}
|
||||||
@@ -12203,7 +12205,7 @@ been published previously in the following papers.
|
|||||||
%
|
%
|
||||||
The results of Sections~\ref{sec:deep-as-shallow} and
|
The results of Sections~\ref{sec:deep-as-shallow} and
|
||||||
\ref{sec:shallow-as-deep} appear in item \ref{en:ch-def-HL18}, whilst
|
\ref{sec:shallow-as-deep} appear in item \ref{en:ch-def-HL18}, whilst
|
||||||
the result of Section~\ref{sec:param-desugaring} appear in item
|
the result of Section~\ref{sec:param-desugaring} appears in item
|
||||||
\ref{en:ch-def-HLA20}.
|
\ref{en:ch-def-HLA20}.
|
||||||
|
|
||||||
\section{Deep as shallow}
|
\section{Deep as shallow}
|
||||||
@@ -13570,10 +13572,10 @@ Figure~\ref{fig:bpcf} depicts the type syntax, type environment
|
|||||||
syntax, and term syntax of $\BPCF$.
|
syntax, and term syntax of $\BPCF$.
|
||||||
%
|
%
|
||||||
The main difference in the type language between $\BCalc$ and $\BPCF$
|
The main difference in the type language between $\BCalc$ and $\BPCF$
|
||||||
is that the latter does feature polymorphism and an effect tracking
|
is that the latter does not feature polymorphism nor an effect
|
||||||
system. At the term level, $\BPCF$ does not feature polymorphic
|
tracking system. At the term level, $\BPCF$ does not feature
|
||||||
records and variants, but rather plain pairs and sums. For sums the
|
polymorphic records and variants, but rather plain pairs and sums. For
|
||||||
left injection is introduced by $(\Inl~V)^B$, where the type
|
sums the left injection is introduced by $(\Inl~V)^B$, where the type
|
||||||
annotation $B$ is the type of the right injection. Similarly, the
|
annotation $B$ is the type of the right injection. Similarly, the
|
||||||
right injection is introduced by $(\Inl~W)^A$, where $A$ is the type
|
right injection is introduced by $(\Inl~W)^A$, where $A$ is the type
|
||||||
of the left injection. The $\Case$-construct eliminates sums. The last
|
of the left injection. The $\Case$-construct eliminates sums. The last
|
||||||
@@ -14258,7 +14260,8 @@ The syntax is extended as follows.
|
|||||||
%
|
%
|
||||||
The notion of configurations changes slightly as the continuation
|
The notion of configurations changes slightly as the continuation
|
||||||
component is replaced by a generalised continuation
|
component is replaced by a generalised continuation
|
||||||
$\kappa \in \MGContCat$, just as described in Chapter~\ref{ch:abstract-machine}% ; a continuation is now a list of
|
$\kappa \in \MGContCat$, in the same way as described in
|
||||||
|
Chapter~\ref{ch:abstract-machine}.% ; a continuation is now a list of
|
||||||
% resumptions. A resumption is a pair of a pure continuation (as in the
|
% resumptions. A resumption is a pair of a pure continuation (as in the
|
||||||
% base machine) and a handler closure ($\chi$).
|
% base machine) and a handler closure ($\chi$).
|
||||||
%
|
%
|
||||||
@@ -17242,7 +17245,7 @@ They identify four variations.
|
|||||||
delimiter in the reified context, but discards the original
|
delimiter in the reified context, but discards the original
|
||||||
instance, i.e.
|
instance, i.e.
|
||||||
\[
|
\[
|
||||||
\Delim{\EC[\CC~k.M]} \reducesto M[\cont_{\EC}/k]
|
\Delim{\EC[\CC~k.M]} \reducesto M[\cont_{\Delim{\EC}}/k]
|
||||||
\]
|
\]
|
||||||
\item[\CCmm] The control reifier reifies the context up to, but not
|
\item[\CCmm] The control reifier reifies the context up to, but not
|
||||||
including, the delimiter and subsequently discards the delimiter, i.e.
|
including, the delimiter and subsequently discards the delimiter, i.e.
|
||||||
@@ -17484,21 +17487,22 @@ the desire to provide a `functional' equivalent of jumps as provided
|
|||||||
by the infamous goto in imperative programming.
|
by the infamous goto in imperative programming.
|
||||||
%
|
%
|
||||||
|
|
||||||
In 1965 Peter \citeauthor{Landin65} unveiled \emph{first} first-class
|
In 1965 Peter \citeauthor{Landin65} unveiled the \emph{first}
|
||||||
control operator: the J
|
first-class control operator: the J
|
||||||
operator~\cite{Landin65,Landin65a,Landin98}. Later in 1972 influenced
|
operator~\cite{Landin65,Landin65a,Landin98}. Later in 1972 influenced
|
||||||
by \citeauthor{Landin65}'s J operator John \citeauthor{Reynolds98a}
|
by \citeauthor{Landin65}'s J operator John \citeauthor{Reynolds98a}
|
||||||
designed the escape operator~\cite{Reynolds98a}. Influenced by escape,
|
designed the escape operator~\cite{Reynolds98a}. Influenced by escape,
|
||||||
\citeauthor{SussmanS75} designed, implemented, and standardised the
|
\citeauthor{SussmanS75} designed, implemented, and standardised the
|
||||||
catch operator in Scheme in 1975. A while thereafter the perhaps most
|
catch operator in Scheme in 1975. A while thereafter the perhaps most
|
||||||
famous undelimited control operator appeared: callcc. It initially
|
famous undelimited control operator appeared: callcc. It was designed
|
||||||
designed in 1982 and was standardised in 1985 as a core feature of
|
in 1982 and standardised in 1985 as a core feature of
|
||||||
Scheme. Later another batch of control operators based on callcc
|
Scheme. Following on from callcc a wide range of different control
|
||||||
appeared. A common characteristic of the early control operators is
|
operators was designed. A common characteristic of the early control
|
||||||
that their capture mechanisms were abortive and their captured
|
operators is that their capture mechanisms are abortive and their
|
||||||
continuations were abortive, save for one, namely,
|
captured continuations are abortive, save for one, namely,
|
||||||
\citeauthor{Felleisen88}'s F operator. Later a non-abortive and
|
\citeauthor{Felleisen88}'s F operator. Though, it is worth remarking
|
||||||
composable variant of callcc appeared. Moreover, every operator,
|
that \citet{FlattYFF07} devised a non-abortive and composable variant
|
||||||
|
of callcc. Another common characteristic is that every operator,
|
||||||
except for \citeauthor{Landin98}'s J operator, capture the current
|
except for \citeauthor{Landin98}'s J operator, capture the current
|
||||||
continuation.
|
continuation.
|
||||||
|
|
||||||
@@ -17830,7 +17834,7 @@ follows.
|
|||||||
\end{reductions}
|
\end{reductions}
|
||||||
%
|
%
|
||||||
Their capture rules are identical. Both operators abort the current
|
Their capture rules are identical. Both operators abort the current
|
||||||
continuation upon capture. This is what set $\FelleisenF$ apart from
|
continuation upon capture. This is what sets $\FelleisenF$ apart from
|
||||||
the other composable control operator $\Callcomc$.
|
the other composable control operator $\Callcomc$.
|
||||||
%
|
%
|
||||||
The resume rules of $\FelleisenC$ and $\FelleisenF$ show the
|
The resume rules of $\FelleisenC$ and $\FelleisenF$ show the
|
||||||
@@ -19020,7 +19024,7 @@ computation $M$ with handler $H$.
|
|||||||
\{\ell_i : A_i \opto B_i\}_i \in \Sigma \\
|
\{\ell_i : A_i \opto B_i\}_i \in \Sigma \\
|
||||||
H = \{\Return\;x \mapsto M\} \uplus \{ \OpCase{\ell_i}{p_i}{k_i} \mapsto N_i \}_i \\
|
H = \{\Return\;x \mapsto M\} \uplus \{ \OpCase{\ell_i}{p_i}{k_i} \mapsto N_i \}_i \\
|
||||||
\el}\\\\
|
\el}\\\\
|
||||||
\typ{\Gamma, x : A;\Sigma}{M : D}\\\\
|
\typ{\Gamma, x : C;\Sigma}{M : D}\\\\
|
||||||
[\typ{\Gamma,p_i : A_i, k_i : B_i \to D;\Sigma}{N_i : D}]_i
|
[\typ{\Gamma,p_i : A_i, k_i : B_i \to D;\Sigma}{N_i : D}]_i
|
||||||
}
|
}
|
||||||
{\typ{\Gamma;\Sigma}{H : C \Harrow D}}
|
{\typ{\Gamma;\Sigma}{H : C \Harrow D}}
|
||||||
@@ -19208,7 +19212,7 @@ handler definitions are identical, however, their typing differ.
|
|||||||
\{\ell_i : A_i \opto B_i\}_i \in \Sigma \\
|
\{\ell_i : A_i \opto B_i\}_i \in \Sigma \\
|
||||||
H = \{\Return\;x \mapsto M\} \uplus \{ \OpCase{\ell_i}{p_i}{k_i} \mapsto N_i \}_i \\
|
H = \{\Return\;x \mapsto M\} \uplus \{ \OpCase{\ell_i}{p_i}{k_i} \mapsto N_i \}_i \\
|
||||||
\el}\\\\
|
\el}\\\\
|
||||||
\typ{\Gamma, x : A;\Sigma}{M : D}\\\\
|
\typ{\Gamma, x : C;\Sigma}{M : D}\\\\
|
||||||
[\typ{\Gamma,p_i : A_i, k_i : B_i \to C;\Sigma}{N_i : D}]_i
|
[\typ{\Gamma,p_i : A_i, k_i : B_i \to C;\Sigma}{N_i : D}]_i
|
||||||
}
|
}
|
||||||
{\typ{\Gamma;\Sigma}{H : C \Harrow D}}
|
{\typ{\Gamma;\Sigma}{H : C \Harrow D}}
|
||||||
@@ -19733,7 +19737,7 @@ overhead, although, techniques such as just-in-time compilation can be
|
|||||||
utilised to reduce this overhead.
|
utilised to reduce this overhead.
|
||||||
|
|
||||||
Continuation passing style (CPS) is a canonical implementation
|
Continuation passing style (CPS) is a canonical implementation
|
||||||
strategy for continuations --- the word `continuation' even feature in
|
strategy for continuations --- the word `continuation' even features in
|
||||||
its name.
|
its name.
|
||||||
%
|
%
|
||||||
CPS is a particular idiomatic notation for programs, where every
|
CPS is a particular idiomatic notation for programs, where every
|
||||||
@@ -19767,9 +19771,9 @@ equations.
|
|||||||
However, the first equation is derivable from the second and third
|
However, the first equation is derivable from the second and third
|
||||||
equations. I first learned this from Paul{-}Andr{\'{e}} Melli{\`{e}}s
|
equations. I first learned this from Paul{-}Andr{\'{e}} Melli{\`{e}}s
|
||||||
during Shonan Seminar No.103 \emph{Semantics of Effects, Resources,
|
during Shonan Seminar No.103 \emph{Semantics of Effects, Resources,
|
||||||
and Applications}. I have been unable to find a proof of this fact
|
and Applications}. I have been unable to find a proof of this fact in
|
||||||
in the literature, though, \citeauthor{Mellies14} does have published
|
the literature, though, \citeauthor{Mellies14} does have a published
|
||||||
paper, which only states the three necessary
|
paper, which states only the three necessary
|
||||||
equations~\cite{Mellies14}.
|
equations~\cite{Mellies14}.
|
||||||
%
|
%
|
||||||
Therefore I include a proof of this fact here (thanks to Sam Lindley
|
Therefore I include a proof of this fact here (thanks to Sam Lindley
|
||||||
@@ -21512,7 +21516,7 @@ $\BergerCount$ program alluded to in Section~\ref{sec:pure-counting},
|
|||||||
in order to fill out our overall picture of the relationship between
|
in order to fill out our overall picture of the relationship between
|
||||||
language expressivity and potential program efficiency.
|
language expressivity and potential program efficiency.
|
||||||
|
|
||||||
\paragraph{Relation to prior work} This appendix imported from
|
\paragraph{Relation to prior work} This appendix is imported from
|
||||||
Appendix D of \citet{HillerstromLL20a}. The code snippets in this
|
Appendix D of \citet{HillerstromLL20a}. The code snippets in this
|
||||||
appendix are based on an implementation of Berger count in SML/NJ
|
appendix are based on an implementation of Berger count in SML/NJ
|
||||||
written by John Longley. I have transcribed the code snippets, and in
|
written by John Longley. I have transcribed the code snippets, and in
|
||||||
|
|||||||
Reference in New Issue
Block a user