1
0
mirror of https://github.com/dhil/phd-dissertation synced 2026-03-13 11:08:25 +00:00

Note on dynamic binding.

This commit is contained in:
2020-10-07 21:16:22 +01:00
parent 39824fcf18
commit e08923dadc
2 changed files with 42 additions and 42 deletions

View File

@@ -460,30 +460,6 @@
year = {2008} year = {2008}
} }
# WebAssembly
@misc{HaasRSTGWBH17,
author = {Andreas Haas and Andreas Rossberg and Ben L. Titzer and Dan Gohman and Luke Wagner and JF Bastien and Michael Holman},
title = {Bringing the {Web} up to Speed with {WebAssembly}},
year = 2017,
note = {Draft},
howpublished = {\url{https://people.mpi-sws.org/~rossberg/papers/Haas, Rossberg, Schuff, Titzer, Gohman, Wagner, Bastien, Holman - Bringing the Web up to Speed with WebAssembly [Draft].pdf}}
}
# ECMAScript
@misc{EMCA15,
author = {{Ecma International}},
title = {{ECMAScript} 2015 Language Specification},
year = 2015,
url = {http://www.ecma-international.org/ecma-262/6.0/index.html}
}
@misc{EMCA17,
author = {{Emca International}},
title = {{ECMAScript} 2017 Language Specification},
year = 2017,
url = {https://tc39.github.io/ecma262/}
}
# Hop.js # Hop.js
@inproceedings{SerranoP16, @inproceedings{SerranoP16,
author = {Manuel Serrano and author = {Manuel Serrano and
@@ -646,7 +622,19 @@
howpublished = {{ML Workshop}} howpublished = {{ML Workshop}}
} }
% fancy row typing systems that support shapes # Delimited Control
@inproceedings{KiselyovSS06,
author = {Oleg Kiselyov and
Chung{-}chieh Shan and
Amr Sabry},
title = {Delimited dynamic binding},
booktitle = {{ICFP}},
pages = {26--37},
publisher = {{ACM}},
year = {2006}
}
# fancy row typing systems that support shapes
@inproceedings{BerthomieuS95, @inproceedings{BerthomieuS95,
author = {Bernard Berthomieu and Camille le Moniès de Sagazan}, author = {Bernard Berthomieu and Camille le Moniès de Sagazan},
title = {A Calculus of Tagged Types, with applications to process languages}, title = {A Calculus of Tagged Types, with applications to process languages},
@@ -663,7 +651,7 @@
} }
# Zipper data structure.
@article{Huet97, @article{Huet97,
author = {G{\'{e}}rard P. Huet}, author = {G{\'{e}}rard P. Huet},
title = {The Zipper}, title = {The Zipper},

View File

@@ -22,11 +22,11 @@
\DeclareCaptionFormat{underlinedfigure}{#1#2#3\hrulefill} \DeclareCaptionFormat{underlinedfigure}{#1#2#3\hrulefill}
\captionsetup[figure]{format=underlinedfigure} \captionsetup[figure]{format=underlinedfigure}
\usepackage[T1]{fontenc} % Fixes issues with accented characters \usepackage[T1]{fontenc} % Fixes issues with accented characters
\usepackage[scaled=0.85]{beramono}
%\usepackage{libertine} %\usepackage{libertine}
%\usepackage{lmodern} %\usepackage{lmodern}
%\usepackage{palatino} %\usepackage{palatino}
% \usepackage{newpxtext,newpxmath} % \usepackage{newpxtext,newpxmath}
\usepackage[scaled=0.85]{beramono}
\usepackage[activate=true, \usepackage[activate=true,
final, final,
tracking=true, tracking=true,
@@ -2204,24 +2204,36 @@ The (delimited) continuation of $\exit~1$ is effectively dead code.
\subsection{Dynamic binding: user-specific environments} \subsection{Dynamic binding: user-specific environments}
\label{sec:tiny-unix-env} \label{sec:tiny-unix-env}
In \UNIX{} an environment maps keys to string-values. A key-value pair is When a process is run in \UNIX{}, the operating system makes available
referred to as an \emph{environment variable}. Each user gets their to the process a collection of name-value pairs called the
own environment with their own set of environment variables. Some \emph{environment}.
environment variable names are common to all environments, but their
valuation may depend on the particular user session. For example, the
environment variable \texttt{USER} is bound to the (string) name of
the user; the result of querying the environment for the value of
\texttt{USER} depends on which user session it is executed under.
% %
\dhil{The value of an environment variable may also change during execution.} The name of a name-value pair is known as an \emph{environment
variable}.
An environment variable is an instance of dynamic binding. The idea of
dynamic binding as a programming notion dates back as far as the
original implementation of Lisp~\cite{McCarthy60}.
% %
We will use dynamic binding to implement user-specific environments. During execution the process may perform a system call to ask the
operating system for the value of some environment variable.
%
The value of environment variables may change throughout process
execution, moreover, the value of some environment variables may vary
according to which user asks the environment.
%
For example, an environment may contain the environment variable
\texttt{USER} that is bound to the name of the inquiring user.
For simplicity we will fix the users to be root, Alice, and Bob. An environment variable can be viewed as an instance of dynamic
binding. The idea of dynamic binding as a binding form in programming
dates back as far as the original implementation of
Lisp~\cite{McCarthy60}, and still finds uses in successors such as
Emacs Lisp~\cite{LewisLSG20}. It is well-known that dynamic binding
can be encoded as a computational effect by using delimited
control~\cite{KiselyovSS06}.
%
Unsurprisingly, we will use this insight to simulate user-specific
environments using effect handlers.
For simplicity we fix the users of the operating system to be root,
Alice, and Bob.
% %
\[ \[
\User \defas [\Alice;\Bob;\Root] \User \defas [\Alice;\Bob;\Root]