\chapter{How do we notate paths?}
\hypertarget{md_home_2simon_2workspace_2post-scarcity_2docs_2_how-do-we-notate-paths}{}\label{md_home_2simon_2workspace_2post-scarcity_2docs_2_how-do-we-notate-paths}\index{How do we notate paths?@{How do we notate paths?}}
\label{md_home_2simon_2workspace_2post-scarcity_2docs_2_how-do-we-notate-paths_autotoc_md61}%
\Hypertarget{md_home_2simon_2workspace_2post-scarcity_2docs_2_how-do-we-notate-paths_autotoc_md61}%
 In order to make the namespaces thing work, we need a convenient way to notate paths from the current namespace to a target, or from the root to a target. This is similar to relative and absolute paths in UNIX, except that in PSSE there is no concept of a single or privileged ancestor namespace to the current namespace, so you have no equivalent of {\ttfamily ../}.

In this discussion, a {\bfseries{namespace}} is just a named, mutable hashmap (but not necessarily mutable by all users; indeed namespaces will almost always be mutable only by selected users. I cannot presently see a justified use for a publicly writable namespace). \textquotesingle{}{\bfseries{Named}}\textquotesingle{}, of a hashmap, merely means there is some path from the privileged root namespace which is the value of {\ttfamily oblist} which leads to that hashmap. A {\bfseries{path}} is in principle just a sequence of keys, such that the value of each successive key is bound to a namespace in the namespace bound by its predecessor. The evaluable implementation of paths will be discussed later.

I think also that there must be a privileged {\bfseries{session}} namespace, containing information about the current session, which the user can read but not write. The session namespace will be indicated by the privileged name \textquotesingle{}{$\S$}\textquotesingle{}.\hypertarget{md_home_2simon_2workspace_2post-scarcity_2docs_2_how-do-we-notate-paths_autotoc_md62}{}\doxysection{\texorpdfstring{Security considerations}{Security considerations}}\label{md_home_2simon_2workspace_2post-scarcity_2docs_2_how-do-we-notate-paths_autotoc_md62}
What\textquotesingle{}s important is that a user cannot rebind privileged names in their own environment. Thus to ensure privileged names, such names must be paths either from the {\ttfamily oblist}or from the current session. So we need magic, privileged notations for these things built into the reader, which cannot be overridden.

This kind of takes away from my general feeling that users should be able to override {\itshape anything}. but hey, that\textquotesingle{}s engineering for you.

Users should be able to override reader macros generally; a programmable reader is in the medium term something which should be implemented. But the privileged syntax for paths should not be overridable.\hypertarget{md_home_2simon_2workspace_2post-scarcity_2docs_2_how-do-we-notate-paths_autotoc_md63}{}\doxysection{\texorpdfstring{Current state of the reader}{Current state of the reader}}\label{md_home_2simon_2workspace_2post-scarcity_2docs_2_how-do-we-notate-paths_autotoc_md63}
At present, you can rebind the value of the symbol {\ttfamily oblist} in the runtime environment. In principle, you should be able to rebind any symbol. Paths and symbols are not the same.

At present, the colon character is a separator character. So if you type

\begin{quote}
(list \+:foo\+:bar\+:ban) \end{quote}
the reader will return

\begin{quote}
(list \+:foo \+:bar \+:ban) \end{quote}
That\textquotesingle{}s significant, and helpful.\hypertarget{md_home_2simon_2workspace_2post-scarcity_2docs_2_how-do-we-notate-paths_autotoc_md64}{}\doxysection{\texorpdfstring{Constructing path notation}{Constructing path notation}}\label{md_home_2simon_2workspace_2post-scarcity_2docs_2_how-do-we-notate-paths_autotoc_md64}
The Clojure threading macro, {\ttfamily -\/\texorpdfstring{$>$}{>}}, is a useful example of how we can implement this. Essentially it takes a expression as its first argument, passes the value of that expression to the function which is its second argument, the value of that as argument to the function which is its next, and so on. Given that, in Clojure, an expression which has a keyword in the function position and a hashmap in the argument position will return the value of that keyword in that hashmap, this means that, given the hashmap

\begin{quote}
 (def x \{\+:foo \{\+:bar \{\+:ban "{}\+Howzat!!"{}\}\}\}) \end{quote}
the expression

\begin{quote}
(-\/\texorpdfstring{$>$}{>} x \+:foo \+:bar \+:ban) \end{quote}
will return

\begin{quote}
"{}\+Howzat!!"{} \end{quote}
So, in general, if we implement the \textquotesingle{}keyword in the function position\textquotesingle{} {\ttfamily eval} hack and the threading macro, then something like

\begin{quote}
(-\/\texorpdfstring{$>$}{>} oblist \+:users \+:simon \+:functions \textquotesingle{}foo) \end{quote}
should return the value of the symbol {\ttfamily foo} in the {\ttfamily \+:functions} of the user called {\ttfamily \+:simon}.

That\textquotesingle{}s stage one of our goal.

Stage two of our goal is that a stream of non-\/separator characters separated by colons should be interpreted as a list of keywords. Thus typing

\begin{quote}
\+:foo\+:bar\+:ban \end{quote}
should result in not just {\ttfamily \+:foo}being read, but the list {\ttfamily (\+:foo \+:bar \+:ban)}(? not sure about this)

Stage 3 is to allow a symbol to be appended to a sequence of keywords written by using {\ttfamily /}as a separator, so

\begin{quote}
\+:foo\+:bar/ban \end{quote}
would be read as {\ttfamily (\+:foo \+:bar \textquotesingle{}ban)}

Finally, we need privileged notation for root (oblist) and for session. There are very few non-\/alpha-\/numeric characters which are available on a standard keyboard and which are not already used as significant lexical characters in Lisp readers. PSSE is not limited, of course, to the characters which are part of the ASCII character set, but it is helpful to use symbols which are reasonably convenient to type, possibly with special keyboard bindings.

So I\textquotesingle{}m going to propose that the reader should interpret

\begin{quote}
/\+:users\+:simon\+:functions/assoc \end{quote}
as

\begin{quote}
(-\/\texorpdfstring{$>$}{>} oblist \+:users \+:simon \+:functions \textquotesingle{}assoc) \end{quote}
where {\ttfamily oblist} is the actual privileged global object list, not just the current binding of {\ttfamily oblist} in the environment. Thus, this expression would return my personal version of the function {\ttfamily assoc}, whatever the symbol {\ttfamily assoc} was bound to in the runtime environment.

The use of the leading slash here follows UNIX convention.

I\textquotesingle{}m going to suggest that the session is referenced by the character {$\S$}, otherwise known as the \textquotesingle{}silcrow\textquotesingle{}. This is not available on most keyboard mappings, so a custom mapping might be needed, or we might have to fall back on {\ttfamily \$}.

Thus the reader should interpret

\begin{quote}
{$\S$}\+:user \end{quote}
as

\begin{quote}
 (-\/\texorpdfstring{$>$}{>} session \+:user) \end{quote}
where {\ttfamily session}is again a system privileged value, not the binding of {\ttfamily session} in the current environment. 