Link Search Menu Expand Document
\( % cbs-katex.sty % \newcommand{\STYLE}[2]{\htmlClass{cbs-#1}{#2}} \newcommand{\DECL}[3]{\htmlId{#1:#2}{#3}} \newcommand{\REF}[3]{\href{###1:#2}{#3}} \newcommand{\HYPER}[5]{\href{#1/#2/index.html###3:#4}{#5}} % \SHADE{MATH} can be defined to produce a shaded background to highlight % inline MATH in running text: \newcommand{\SHADE}[1]{#1} % \KEY{TEXT}, \STRING{TEXT}, \ATOM{TEXT}, \LEX{TEXT} can be used in math mode: \newcommand{\KEY}[1]{\textsf{\textit{\STYLE{Key}{#1}}}} \newcommand{\STRING}[1]{\textsf{``\texttt{#1}''}} \newcommand{\ATOM}[1]{\textsf{`\texttt{#1}'}} \newcommand{\LEX}[1]{\textsf{\STYLE{Key}{`}\texttt{#1}\STYLE{Key}{'}}} % The following commands produce ASCII characters that are treated specially by LaTeX: \newcommand{\HASH}{\char`\#} \newcommand{\DOLLAR}{\char`\$} \newcommand{\PERCENT}{\char`\%} \newcommand{\AMPERSAND}{\char`\&} \newcommand{\APOSTROPHE}{\char`\'} \newcommand{\BACKSLASH}{\char`\\} \newcommand{\CARET}{\char`\^} \newcommand{\UNDERSCORE}{\char`\_} \newcommand{\GRAVE}{\char`\`} \newcommand{\LEFTBRACE}{\char`\{} \newcommand{\RIGHTBRACE}{\char`\}} \newcommand{\TILDE}{\textasciitilde} % {\char`\~} % \NAME{name} highlights the name; % \NAMEDECL{name} declares Name.name as the target of links to name; % \NAMEREF{name} links name to the target Name.name in the current file; % \NAMEHYPER{url}{file}{name} links name to Name.name at url/file/file.pdf. % Similarly for \VAR{partvariable}, \SYN{syntaxname}, \SEM{semanticsName}, % and \SECT{sectionnumber} % The kerns in \SUB and \VAR avoid overlaps with primes: \newcommand{\SUB}[1]{_{\kern-2mu\STYLE{PartVariable}{\textsf{#1}}}} % PLAIN \newcommand{\VAR}[1]{\STYLE{PartVariable}{\textsf{\textit{#1}\kern2mu}}} \newcommand{\NAME}[1]{\STYLE{Name}{\textsf{#1}}} \newcommand{\SYN}[1]{\STYLE{SyntaxName}{\textsf{#1}}} \newcommand{\SEM}[1]{\STYLE{SemanticsName}{\textsf{#1}}} \newcommand{\SECT}[1]{\STYLE{SectionNumber}{\textsf{#1}}} % DECL \newcommand{\VARDECL}[1]{\DECL{PartVariable}{#1}{\VAR{#1}}} \newcommand{\NAMEDECL}[1]{\DECL{Name}{#1}{\NAME{#1}}} \newcommand{\SYNDECL}[1]{\DECL{SyntaxName}{#1}{\SYN{#1}}} \newcommand{\SEMDECL}[1]{\DECL{SemanticsName}{#1}{\SEM{#1}}} \newcommand{\SECTDECL}[1]{\DECL{SectionNumber}{#1}{\textsf{#1}}} % REF \newcommand{\VARREF}[1]{\REF{PartVariable}{#1}{\VAR{#1}}} \newcommand{\NAMEREF}[1]{\REF{Name}{#1}{\NAME{#1}}} \newcommand{\SYNREF}[1]{\REF{SyntaxName}{#1}{\SYN{#1}}} \newcommand{\SEMREF}[1]{\REF{SemanticsName}{#1}{\SEM{#1}}} \newcommand{\SECTREF}[1]{\REF{SectionNumber}{#1}{\SECT{#1}}} % HYPER \newcommand{\VARHYPER}[3]{\HYPER{#1}{#2}{PartVariable}{#3}{\VAR{#3}}} \newcommand{\NAMEHYPER}[3]{\HYPER{#1}{#2}{Name}{#3}{\NAME{#3}}} \newcommand{\SYNHYPER}[3]{\HYPER{#1}{#2}{SyntaxName}{#3}{\SYN{#3}}} \newcommand{\SEMHYPER}[3]{\HYPER{#1}{#2}{SemanticsName}{#3}{\SEM{#3}}} \newcommand{\SECTHYPER}[3]{\HYPER{#1}{#2}{SectionNumber}{#3}{\SECT{#3}}} % \LEFTPHRASE MATH \RIGHTPHRASE produces [[ MATH ]] with proper brackets: \newcommand{\LEFTPHRASE}{\llbracket} \newcommand{\RIGHTPHRASE}{\rrbracket} % \LEFTGROUP MATH \RIGHTGROUP produces ( MATH ) where the parentheses are % highlighted the same as keywords: \newcommand{\LEFTGROUP}{\STYLE{Key}{(}} \newcommand{\RIGHTGROUP}{\STYLE{Key}{)}} % MATH\PLUS produces a superscript + % MATH\STAR produces a superscript * % MATH\QUERY produces a superscript ? \newcommand{\PLUS}{{}^{\texttt{+}}} \newcommand{\STAR}{{}^{\texttt{*}}} \newcommand{\QUERY}{{}^{\texttt{?}}} % \RULE{& PREMISE \\ & ...}{& FORMULA ... \\ & ...} produces an inference rule % with separately aligned premises and conclusion % PREMISE % ... % ----------- % FORMULA ... % ... \newcommand{\RULE}[2] {\frac{\begin{aligned}#1\end{aligned}}{\begin{aligned}#2\end{aligned}}} % \AXIOM{& FORMULA ... \\ & ...} produces an aligned formula % % FORMULA ... % ... \newcommand{\AXIOM}[1]{\begin{aligned}#1\end{aligned}} % \TO TYPE produces => TYPE \newcommand{\TO}{\mathop{\Rightarrow}} % TERM \TRANS TERM produces TERM ---> TERM \newcommand{\TRANS}{\longrightarrow} % TERM \xrightarrow{LABEL} TERM puts the label above the long arrow % \)

Funcons-beta : Classes.cbs | PLAIN | PDF


Classes

\[\begin{align*} [ \ \KEY{Datatype} \quad & \NAMEREF{classes} \\ \KEY{Funcon} \quad & \NAMEREF{class} \\ \KEY{Funcon} \quad & \NAMEREF{class-instantiator} \\ \KEY{Funcon} \quad & \NAMEREF{class-feature-map} \\ \KEY{Funcon} \quad & \NAMEREF{class-superclass-name-sequence} \\ \KEY{Funcon} \quad & \NAMEREF{class-name-tree} \\ \KEY{Funcon} \quad & \NAMEREF{is-subclass-name} \\ \KEY{Funcon} \quad & \NAMEREF{class-name-single-inheritance-feature-map} \ ] \end{align*}\] \[\begin{align*} \KEY{Datatype} \quad \NAMEDECL{classes} \ ::= \ & \NAMEDECL{class}( \_ : \NAMEHYPER{../../Abstraction}{Thunks}{thunks} ( \NAMEHYPER{../.}{References}{references} ( \NAMEHYPER{../.}{Objects}{objects} ) ), \_ : \NAMEHYPER{../../../Computations/Normal}{Binding}{environments}, \_ : \NAMEHYPER{../../../Computations/Normal}{Binding}{identifiers}\STAR) \end{align*}\]

\(\SHADE{\NAMEREF{class} ( \VAR{Thunk}, \VAR{Env}, \VAR{C}\STAR )}\) is a class with:

  • a thunk \(\SHADE{\VAR{Thunk}}\) for instantiating the class,
  • an environment \(\SHADE{\VAR{Env}}\) with the features declared by the class, and
  • a sequence \(\SHADE{\VAR{C}\STAR}\) of names of direct superclasses. \(\SHADE{\NAMEREF{class} ( \VAR{Thunk}, \VAR{Env} )}\) is a base class, having no superclasses. \(\SHADE{\NAMEREF{class} ( \VAR{Thunk}, \VAR{Env}, \VAR{C} )}\) is a class with a single superclass.

Class instantiation forces its thunk to compute a reference to an object.

Features are inherited from superclasses. When features with the same name are declared in simultaneously inherited classes, the order of the superclass identifiers in \(\SHADE{\VAR{C}\STAR}\) may affect resolution of references to features. Overloading of feature names is supported by using type maps as features.

The class table is represented by binding class names to classes. The class superclass hierarchy is assumed to be acyclic.

\[\begin{align*} \KEY{Funcon} \quad & \NAMEDECL{class-instantiator}( \_ : \NAMEREF{classes}) : \TO \NAMEHYPER{../../Abstraction}{Thunks}{thunks} ( \NAMEHYPER{../.}{References}{references} ( \NAMEHYPER{../.}{Objects}{objects} ) ) \\ \KEY{Rule} \quad & \NAMEREF{class-instantiator} \\&\quad \NAMEREF{class} ( \VAR{Thunk} : \NAMEHYPER{../../Abstraction}{Thunks}{thunks} ( \_ ), \VAR{Envs} : \NAMEHYPER{../../../Computations/Normal}{Binding}{environments}, \VAR{C}\STAR : \NAMEHYPER{../../../Computations/Normal}{Binding}{identifiers}\STAR ) \leadsto \\&\quad \VAR{Thunk} \end{align*}\] \[\begin{align*} \KEY{Funcon} \quad & \NAMEDECL{class-feature-map}( \_ : \NAMEREF{classes}) : \TO \NAMEHYPER{../../../Computations/Normal}{Binding}{environments} \\ \KEY{Rule} \quad & \NAMEREF{class-feature-map} \\&\quad \NAMEREF{class} ( \VAR{Thunk} : \NAMEHYPER{../../Abstraction}{Thunks}{thunks} ( \_ ), \VAR{Env} : \NAMEHYPER{../../../Computations/Normal}{Binding}{environments}, \VAR{C}\STAR : \NAMEHYPER{../../../Computations/Normal}{Binding}{identifiers}\STAR ) \leadsto \\&\quad \VAR{Env} \end{align*}\] \[\begin{align*} \KEY{Funcon} \quad & \NAMEDECL{class-superclass-name-sequence}( \_ : \NAMEREF{classes}) : \TO \NAMEHYPER{../../../Computations/Normal}{Binding}{identifiers}\STAR \\ \KEY{Rule} \quad & \NAMEREF{class-superclass-name-sequence} \\&\quad \NAMEREF{class} ( \VAR{Thunk} : \NAMEHYPER{../../Abstraction}{Thunks}{thunks} ( \_ ), \VAR{Env} : \NAMEHYPER{../../../Computations/Normal}{Binding}{environments}, \VAR{C}\STAR : \NAMEHYPER{../../../Computations/Normal}{Binding}{identifiers}\STAR ) \leadsto \\&\quad \VAR{C}\STAR \end{align*}\] \[\begin{align*} \KEY{Funcon} \quad & \NAMEDECL{class-name-tree}( \_ : \NAMEHYPER{../../../Computations/Normal}{Binding}{identifiers}) : \TO \NAMEHYPER{../.}{Trees}{trees} ( \NAMEHYPER{../../../Computations/Normal}{Binding}{identifiers} ) \end{align*}\]

\(\SHADE{\NAMEREF{class-name-tree} \ \VAR{C}}\) forms a tree where the branches are the class name trees for the superclasses of \(\SHADE{\VAR{C}}\).

\[\begin{align*} \KEY{Rule} \quad & \NAMEREF{class-name-tree} ( \VAR{C} : \NAMEHYPER{../../../Computations/Normal}{Binding}{identifiers} ) \leadsto \\&\quad \NAMEHYPER{../.}{Trees}{tree} ( \\&\quad\quad \VAR{C}, \\&\quad\quad \NAMEHYPER{../../../Computations/Normal}{Giving}{interleave-map} ( \\&\quad\quad\quad \NAMEREF{class-name-tree} \ \NAMEHYPER{../../../Computations/Normal}{Giving}{given}, \\&\quad\quad\quad \NAMEREF{class-superclass-name-sequence} \ \NAMEHYPER{../../../Computations/Normal}{Binding}{bound-value} \ \VAR{C} ) ) \end{align*}\] \[\begin{align*} \KEY{Funcon} \quad & \NAMEDECL{is-subclass-name}( \VAR{C} : \NAMEHYPER{../../../Computations/Normal}{Binding}{identifiers}, \VAR{C}' : \NAMEHYPER{../../../Computations/Normal}{Binding}{identifiers}) : \TO \NAMEHYPER{../../Primitive}{Booleans}{booleans} \\&\quad \leadsto \NAMEHYPER{../.}{Sets}{is-in-set} ( \VAR{C}, \{ \NAMEHYPER{../.}{Trees}{forest-value-sequence} \ \NAMEREF{class-name-tree} \ \VAR{C}' \} ) \end{align*}\]

The result of \(\SHADE{\NAMEREF{is-subclass-name} ( \VAR{C}, \VAR{C}' )}\) does not depend on the order of the names in \(\SHADE{\NAMEHYPER{../.}{Trees}{forest-value-sequence} \ \NAMEREF{class-name-tree} \ \VAR{C}'}\).

\[\begin{align*} \KEY{Funcon} \quad & \NAMEDECL{class-name-single-inheritance-feature-map}( \VAR{C} : \NAMEHYPER{../../../Computations/Normal}{Binding}{identifiers}) : \TO \NAMEHYPER{../../../Computations/Normal}{Binding}{environments} \\&\quad \leadsto \NAMEHYPER{../.}{Maps}{map-override} \ \NAMEHYPER{../../../Computations/Normal}{Giving}{interleave-map} ( \\&\quad\quad\quad\quad \NAMEREF{class-feature-map} \ \NAMEHYPER{../../../Computations/Normal}{Binding}{bound-value} \ \NAMEHYPER{../../../Computations/Normal}{Giving}{given}, \\&\quad\quad\quad\quad \NAMEHYPER{../.}{Trees}{single-branching-sequence} \ \NAMEREF{class-name-tree} \ \VAR{C} ) \end{align*}\]

For multiple inheritance, different resolution orders can be specified by using different linearisations of the class name tree.