source: doc/theses/mike_brooks_MMath/list.tex@ 9d9fd81

Last change on this file since 9d9fd81 was 9d9fd81, checked in by Peter A. Buhr <pabuhr@…>, 5 months ago

more proofreading of list API

  • Property mode set to 100644
File size: 23.5 KB
Line 
1\chapter{Linked List}
2
3This chapter presents my work on designing and building a linked-list library for \CFA.
4Due to time limitations and the needs expressed by the \CFA runtime developers, I focussed on providing a doubly-linked list, and its bidirectionally iterators for traversal.
5Simpler data-structures, like stack and queue, can be built from the doubly-linked mechanism with only a slight storage/performance cost because of the unused link field.
6Reducing to data-structures with a single link follows directly from the more complex doubly-links and its iterators.
7
8
9\section{Features}
10
11The following features directed this project, where the goal is high-performance list operations required by \CFA runtime components, like the threading library.
12
13
14\subsection{Core Design Issues}
15
16The doubly-linked list attaches links intrusively, supports multiple link directions, integrates with user code via the type system, treats its ends uniformly, and identifies a list using an explicit head.
17This design covers system and data management issues stated in Section~\ref{toc:lst:issue}.
18
19Figure~\ref{fig:lst-features-intro} continues the running @req@ example from Figure~\ref{fig:lst-issues-attach} using the \CFA list.
20The \CFA link attachment is intrusive so the resulting memory layout is per user node, as for the LQ version of Figure~\ref{f:Intrusive}.
21The \CFA framework provides generic type @dlink( T, T )@ for the two link fields (front and back).
22A user inserts the links into the @req@ structure via \CFA inline-inheritance from the Plan-9 C dialect~\cite[\S~3.3]{Thompson90new}.
23Inline inheritance is containment, where the inlined field is unnamed but the type's internal fields are hoisted into the containing structure.
24Hence, the field names must be unique, unlike \CC nested types, but the type names are at a nested scope level, unlike aggregate nesting in C.
25Note, the position of the containment is normally unimportant, unless there is some form of memory or @union@ overlay.
26The key feature of inlined inheritance is that a pointer to the containing structure is automatically converted to a pointer to any anonymous inline field for assignments and function calls, providing containment inheritance with implicit subtyping.
27Therefore, a reference to a @req@ is implicitly convertible to @dlink@ in assignments and function calls.
28% These links have a nontrivial, user-specified location within the @req@ structure;
29% this convention encapsulates the implied pointer arithmetic safely.
30The links in @dlist@ point at (links) in the containing node, know the offsets of all links (data is abstract), and any field-offset arithmetic or link-value changes are safe and abstract.
31
32\begin{figure}
33 \lstinput{20-30}{lst-features-intro.run.cfa}
34 \caption[Multiple link directions in \CFA list library]{
35 Demonstration of the running \lstinline{req} example, done using the \CFA list library.
36 This example is equivalent to the three approaches in Figure~\ref{fig:lst-issues-attach}.
37 }
38 \label{fig:lst-features-intro}
39\end{figure}
40
41Figure~\ref{fig:lst-features-multidir} shows how the \CFA library supports multi-inline links, so a node can be on one or more lists simultaneously.
42The declaration of @req@ has two inline-inheriting @dlink@ occurrences.
43The first of these gives a type named @req.by_pri@, @req@ inherits from it, and it inherits from @dlink@.
44The second line @req.by_rqr@ is similar to @req.by_pri@.
45Thus, there is a diamond, non-virtual, inheritance from @req@ to @dlink@, with @by_pri@ and @by_rqr@ being the mid-level types.
46
47Disambiguation occurs in the declarations of the list-head objects: @reqs_pri_global@, @reqs_rqr_42@, @reqs_rqr_17@, and @reqs_rqr_99@.
48The type of the variable @reqs_pri_global@ is @dlist(req, req.by_pri)@, meaning operations called on @reqs_pri_global@ are implicitly disambiguated.
49In the example, the calls @insert_first(reqs_pri_global, ...)@ imply, ``here, we are working by priority.''
50As in Figure~\ref{fig:lst-issues-multi-static}, three lists are constructed, a priority list containing all nodes, a list with only nodes containing the value 42, and a list with only nodes containing the value 17.
51
52\begin{figure}
53\centering
54\begin{tabular}{@{}ll@{}}
55\begin{tabular}{@{}l@{}}
56 \lstinput{20-31}{lst-features-multidir.run.cfa} \\
57 \lstinput{43-71}{lst-features-multidir.run.cfa}
58 \end{tabular}
59 &
60 \lstinput[language=C++]{20-60}{lst-issues-multi-static.run.c}
61 \end{tabular}
62
63\caption{
64 Demonstration of multiple static link directions done in the \CFA list library.
65 The right example is from Figure~\ref{fig:lst-issues-multi-static}.
66 The left \CFA example does the same job.
67 }
68 \label{fig:lst-features-multidir}
69\end{figure}
70
71The \CFA library also supports the common case, of single directionality, more naturally than LQ.
72Figure~\ref{fig:lst-features-intro} shows a single-direction list done with no contrived name for the link direction,
73where Figure~\ref{f:Intrusive} adds the unnecessary field name, @d@.
74In \CFA, a user doing a single direction (Figure~\ref{fig:lst-features-intro}) sets up a simple inheritance with @dlink@, and declares a list head to have the simpler type @dlist( T )@.
75In contrast, (Figure~\ref{fig:lst-features-multidir}) sets up a diamond inheritance with @dlink@, and declares a list head to have the more-informed type @dlist( T, DIR )@.
76
77The directionality issue also has an advanced corner-case that needs treatment.
78When working with multiple directions, calls like @insert_first@ benefit from implicit direction disambiguation;
79however, other calls like @insert_after@ still require explicit disambiguation, \eg the call
80\begin{cfa}
81insert_after(r1, r2);
82\end{cfa}
83does not have enough information to clarify which of a request's simultaneous list directions is intended.
84Is @r2@ supposed to be the next-priority request after @r1@, or is @r2@ supposed to join the same-requester list of @r1@?
85As such, the \CFA compiler gives an ambiguity error for this call.
86To resolve the ambiguity, the list library provides a hook for applying the \CFA language's scoping and priority rules.
87It applies as:
88\begin{cfa}
89with ( DLINK_VIA(req, req.pri) ) insert_after(r1, r2);
90\end{cfa}
91Here, the @with@ statement opens the scope of the object type for the expression;
92hence, the @DLINK_VIA@ result causes one of the list directions to become a more attractive candidate to \CFA's overload resolution.
93This boost applies within the scope of the following statement, but could also be a custom block or an entire function body.
94\begin{cquote}
95\setlength{\tabcolsep}{15pt}
96\begin{tabular}{@{}ll@{}}
97\begin{cfa}
98void f() @with( DLINK_VIA(req, req.pri) )@ {
99 ...
100
101 insert_after(r1, r2);
102
103 ...
104}
105\end{cfa}
106&
107\begin{cfa}
108void f() {
109 ...
110 @with( DLINK_VIA(req, req.pri) )@ {
111 ... insert_after(r1, r2); ...
112 }
113 ...
114}
115\end{cfa}
116\end{tabular}
117\end{cquote}
118By using a larger scope, a user can put code within that acts as if there is only one list direction.
119This boost is needed only when operating on a list with several directions, using operations that do not take the list head.
120Otherwise, the sole applicable list direction ``just works.''
121
122Unlike \CC templates container-types, the \CFA library works completely within the type system;
123both @dlink@ and @dlist@ are ordinary types.
124There is no textual expansion other than header-included static-inline function for performance.
125Errors in user code are reported only with mention of the library's declarations.
126Finally, the library is separately compiled from the usage code.
127
128The \CFA library works in headed and headless modes. TODO: elaborate.
129
130
131\section{List API}
132
133\VRef[Figure]{f:ListAPI} shows the API for the doubly-link list operations, where each is explained.
134\begin{itemize}[leftmargin=*]
135\item
136@isListed@ returns true if the node is an element of a list and false otherwise.
137\item
138@isEmpty@ returns true if the list has no nodes and false otherwise.
139\item
140@first@ returns a pointer to the first node of the list without removing it or @0p@ if the list is empty.
141\item
142@last@ returns a pointer to the last node of the list without removing it or @0p@ if the list is empty.
143\item
144@next@ returns a pointer to the next (successor, towards last) node after the specified node or @0p@ if the specified node is the last node in the list.
145\item
146@pred@ returns a pointer to the previous (predecessor, towards first) node before the specified node or @0p@ if the specified node is the first node in the list.
147\item
148@insert_before@ adds a node before the specified node and returns the added node for cascading.
149\item
150@insert_after@ adds a node after the specified node and returns the added node for cascading.
151\item
152@remove@ removes the specified node from the list (any location) and returns a pointer to the node.
153\item
154@insert_first@ adds a node to the start of the list so it becomes the first node and returns a pointer to the node for cascading.
155\item
156@insert_last@ adds a node to the end of the list so it becomes the last node and returns returns a pointer to the node for cascading.
157\item
158@insert@ is a synonym for @insert_last@.
159\item
160@remove_first@ removes the first node and returns a pointer to it or @0p@ if the list is empty.
161\item
162@remove_last@ removes the last node and returns a pointer to it or @0p@ if the list is emptyy.
163\item
164@transfer@ transfers all nodes from the @from@ list to the end of the @to@ list; the @from@ list is empty after the transfer.
165\item
166@split@ transfers the @from@ list up to node to the end of the @to@ list; the @from@ list becomes the list after the node.
167The node must be in the @from@ list.
168\end{itemize}
169
170\begin{figure}
171\begin{cfa}
172E & ?`isEmpty( dlist( E ) & list );
173E & ?`isListed( E & node );
174E & ?`first( dlist( E ) & list );
175E & ?`last( dlist( E ) & list );
176E & ?`next( E & node );
177E & ?`prev( E & node );
178E & insert_before( E & before, E & node );
179E & insert_after( E & after, E & node );
180E & remove( E & node );
181E & ?`elems( dlist( E ) & list );
182E & ?`head( dlist( E ) & list );
183bool ?`moveNext( E && refx );
184bool ?`next( E && refx ); // alternate name
185bool ?`movePrev( E && refx );
186bool ?`prev( E && refx ); // alternate name
187bool ?`hasNext( E & node );
188bool ?`hasPrev( E & node );
189E & insert_first( dlist( E ) & list, E & node );
190E & insert_last( dlist( E ) & list, E & node );
191E & insert( dlist( E ) & list, E & node ); // alternate name
192E & remove_first( dlist( E ) & list );
193E & remove_last( dlist( E ) & list );
194void transfer( dlist( E ) & to, dlist( E ) & from ) {
195void split( dlist( E ) & to, dlist( E ) & from, E & node ) {
196E & try_pop_front( dlist( E ) & list );
197E & try_pop_back( dlist( E ) & list );
198\end{cfa}
199\caption{\CFA List API}
200\label{f:ListAPI}
201\end{figure}
202
203
204\subsection{Iteration}
205
206It is possible to iterate through a list manually or using a set of standard macros.
207\VRef[Figure]{f:IteratorExample} shows the iterator template, managing a list of nodes, used throughout the following iterator examples.
208Each example assumes its loop body prints the value in the current node.
209
210\begin{figure}
211\begin{cfa}
212#include <fstream.hfa>
213#include <list.hfa>
214
215struct node {
216 int v;
217 inline dlink(node);
218};
219int main() {
220 dlist(node) list;
221 node n1 = { 1 }, n2 = { 2 }, n3 = { 3 }, n4 = { 4 };
222 insert( list, n1 ); insert( list, n2 ); insert( list, n3 ); insert( list, n4 );
223 sout | nlOff;
224 for ( node & it = list`first; &it; &it = &it`next ) @sout | it.v | ","; sout | nl;@
225 // other iterator examples
226 remove( n1 ); remove( n2 ); remove( n3 ); remove( n4 );
227}
228\end{cfa}
229\caption{Iterator Example}
230\label{f:IteratorExample}
231\end{figure}
232
233The manual method is low level but allows complete control of the iteration.
234The list cursor (index) can be either a pointer or a reference to a node in the list.
235The choice depends on how the programmer wants to access the fields: @it->f@ or @it.f@.
236The following examples use a reference because the loop body manipulates the node values rather than the list pointers.
237The end of iteration is denoted by the loop cursor having the null pointer, denoted @0p@ in \CFA.
238
239\noindent
240Iterating forward and reverse through the entire list.
241\begin{cquote}
242\setlength{\tabcolsep}{15pt}
243\begin{tabular}{@{}l|l@{}}
244\begin{cfa}
245for ( node & it = list`@first@; &it /* != 0p */ ; &it = &it`@next@ ) ...
246for ( node & it = list`@last@; &it; &it = &it`@prev@ ) ...
247\end{cfa}
248&
249\begin{cfa}
2501, 2, 3, 4,
2514, 3, 2, 1,
252\end{cfa}
253\end{tabular}
254\end{cquote}
255Iterating forward and reverse from a starting node through the remaining list.
256\begin{cquote}
257\setlength{\tabcolsep}{15pt}
258\begin{tabular}{@{}l|l@{}}
259\begin{cfa}
260for ( node & it = @n2@; &it; &it = &it`@next@ ) ...
261for ( node & it = @n3@; &it; &it = &it`@prev@ ) ...
262\end{cfa}
263&
264\begin{cfa}
2652, 3, 4,
2663, 2, 1,
267\end{cfa}
268\end{tabular}
269\end{cquote}
270Iterating forward and reverse from a starting node to an ending node through the remaining list.
271\begin{cquote}
272\setlength{\tabcolsep}{15pt}
273\begin{tabular}{@{}l|l@{}}
274\begin{cfa}
275for ( node & it = @n2@; &it @!= &n4@; &it = &it`@next@ ) ...
276for ( node & it = @n4@; &it @!= &n2@; &it = &it`@prev@ ) ...
277\end{cfa}
278&
279\begin{cfa}
2802, 3,
2814, 3,
282\end{cfa}
283\end{tabular}
284\end{cquote}
285Iterating forward and reverse through the entire list using the shorthand start at the list head and pick a direction.
286In this case, @next@ and @prev@ return a boolean, like \CC @while ( cin >> i )@.
287\begin{cquote}
288\setlength{\tabcolsep}{15pt}
289\begin{tabular}{@{}l|l@{}}
290\begin{cfa}
291for ( node & it = list`@head@; it`@next@; ) ...
292for ( node & it = list`@head@; it`@prev@; ) ...
293\end{cfa}
294&
295\begin{cfa}
2961, 2, 3, 4,
2974, 3, 2, 1,
298\end{cfa}
299\end{tabular}
300\end{cquote}
301Finally, there are convenience macros that look like @foreach@ in other programming languages.
302Iterating forward and reverse through the entire list.
303\begin{cquote}
304\setlength{\tabcolsep}{15pt}
305\begin{tabular}{@{}l|l@{}}
306\begin{cfa}
307FOREACH( list, it ) ...
308FOREACH_REV( list, it ) ...
309\end{cfa}
310&
311\begin{cfa}
3121, 2, 3, 4,
3134, 3, 2, 1,
314\end{cfa}
315\end{tabular}
316\end{cquote}
317Iterating forward and reverse through the entire list or until a predicate is triggered.
318\begin{cquote}
319\setlength{\tabcolsep}{15pt}
320\begin{tabular}{@{}l|l@{}}
321\begin{cfa}
322FOREACH_COND( list, it, @it.v == 3@ ) ...
323FOREACH_REV_COND( list, it, @it.v == 1@ ) ...
324\end{cfa}
325&
326\begin{cfa}
3271, 2,
3284, 3, 2,
329\end{cfa}
330\end{tabular}
331\end{cquote}
332The ability to provide a language-level @foreach@ is a future \CFA project.
333Finally, a predicate can be added to any of the manual iteration loops.
334\begin{cquote}
335\setlength{\tabcolsep}{15pt}
336\begin{tabular}{@{}l|l@{}}
337\begin{cfa}
338for ( node & it = list`first; &it @&& !(it.v == 3)@; &it = &it`next ) ...
339for ( node & it = list`last; &it @&& !(it.v == 1)@; &it = &it`prev ) ...
340for ( node & it = list`head; it`next @&& !(it.v == 3)@; ) ...
341for ( node & it = list`head; it`prev @&& !(it.v == 1)@; ) ...
342\end{cfa}
343&
344\begin{cfa}
3451, 2,
3464, 3, 2,
3471, 2,
3484, 3, 2,
349\end{cfa}
350\end{tabular}
351\end{cquote}
352
353\begin{comment}
354Many languages offer an iterator interface for collections, and a corresponding for-each loop syntax for consuming the items through implicit interface calls.
355\CFA does not yet have a general-purpose form of such a feature, though it has a form that addresses some use cases.
356This section shows why the incumbent \CFA pattern does not work for linked lists and gives the alternative now offered by the linked-list library.
357Chapter 5 [TODO: deal with optimism here] presents a design that satisfies both uses and accommodates even more complex collections.
358
359The current \CFA extensible loop syntax is:
360\begin{cfa}
361for( elem; end )
362for( elem; begin ~ end )
363for( elem; begin ~ end ~ step )
364\end{cfa}
365Many derived forms of @begin ~ end@ exist, but are used for defining numeric ranges, so they are excluded from the linked-list discussion.
366These three forms are rely on the iterative trait:
367\begin{cfa}
368forall( T ) trait Iterate {
369 void ?{}( T & t, zero_t );
370 int ?<?( T t1, T t2 );
371 int ?<=?( T t1, T t2 );
372 int ?>?( T t1, T t2 );
373 int ?>=?( T t1, T t2 );
374 T ?+=?( T & t1, T t2 );
375 T ?+=?( T & t, one_t );
376 T ?-=?( T & t1, T t2 );
377 T ?-=?( T & t, one_t );
378}
379\end{cfa}
380where @zero_t@ and @one_t@ are constructors for the constants 0 and 1.
381The simple loops above are abbreviates for:
382\begin{cfa}
383for( typeof(end) elem = @0@; elem @<@ end; elem @+=@ @1@ )
384for( typeof(begin) elem = begin; elem @<@ end; elem @+=@ @1@ )
385for( typeof(begin) elem = @0@; elem @<@ end; elem @+=@ @step@ )
386\end{cfa}
387which use a subset of the trait operations.
388The shortened loop works well for iterating a number of times or through an array.
389\begin{cfa}
390for ( 20 ) // 20 iterations
391for ( i: 1 ~= 21 ~ 2 ) // odd numbers
392for ( i; n ) total += a[i]; // subscripts
393\end{cfa}
394which is similar to other languages, like JavaScript.
395\begin{cfa}
396for ( i in a ) total += a[i];
397\end{cfa}
398Albeit with different mechanisms for expressing the array's length.
399It might be possible to take the \CC iterator:
400\begin{c++}
401for ( list<int>::iterator it=mylist.begin(); it != mylist.end(); ++it )
402\end{c++}
403and convert it to the \CFA form
404\begin{cfa}
405for ( it; begin() ~= end() )
406\end{cfa}
407by having a list operator @<=@ that just looks for equality, and @+=@ that moves to the next node, \etc.
408
409However, the list usage is contrived, because a list does use its data values for relational comparison, only links for equality comparison.
410Hence, the focus of a list iterator's stopping condition is fundamentally different.
411So, iteration of a linked list via the existing loop syntax is to ask whether this syntax can also do double-duty for iterating values.
412That is, to be an analog of JavaScript's @for..of@ syntax:
413\begin{cfa}
414for ( e of a ) total += e;
415\end{cfa}
416
417The \CFA team will likely implement an extension of this functionality that moves the @~@ syntax from being part of the loop, to being a first-class operator (with associated multi-pace operators for the elided derived forms).
418With this change, both @begin ~ end@ and @end@ (in context of the latter ``two-place for'' expression) parse as \emph{ranges}, and the loop syntax becomes, simply:
419\begin{cfa}
420 for( elem; rangeExpr )
421\end{cfa}
422The expansion and underlying API are under discussion.
423TODO: explain pivot from ``is at done?'' to ``has more?''
424Advantages of this change include being able to pass ranges to functions, for example, projecting a numerically regular subsequence of array entries, and being able to use the loop syntax to cover more collection types, such as looping over the keys of a hashtable.
425
426When iterating an empty list, the question, ``Is there a further element?'' needs to be posed once, receiving the answer, ``no.''
427When iterating an $n$-item list, the same question gets $n$ ``yes'' answers (one for each element), plus one ``no'' answer, once there are no more elements; the question is posed $n+1$ times.
428
429When iterating an empty list, the question, ``What is the value of the current element?'' is never posed, nor is the command, ``Move to the next element,'' issued. When iterating an $n$-item list, each happens $n$ times.
430
431So, asking about the existence of an element happens once more than retrieving an element's value and advancing the position.
432
433Many iteration APIs deal with this fact by splitting these steps across different functions, and relying on the user's knowledge of iterator state to know when to call each. In Java, the function @hasNext@ should be called $n+1$ times and @next@ should be called $n$ times (doing the double duty of advancing the iteration and returning a value). In \CC, the jobs are split among the three actions, @it != end@, @it++@ and @*it@, the latter two being called one time more than the first.
434
435TODO: deal with simultaneous axes: @DLINK_VIA@ just works
436
437TODO: deal with spontaneous simultaneity, like a single-axis req, put into an array: which ``axis'' is @&req++@ navigating: array-adjacency vs link dereference. It should sick according to how you got it in the first place: navigating dlist(req, req.pri) vs navigating array(req, 42). (prob. future work)
438\end{comment}
439
440
441
442\section{Implementation}
443
444\subsection{Links}
445
446\VRef[Figure]{fig:lst-impl-links} continues the running @req@ example, now showing the \CFA list library's internal representation.
447The @dlink@ structure contains exactly two pointers: @next@ and @prev@, which are opaque to a user.
448Even though the user-facing list model is ordered (linear), the CFA library implements all listing as circular.
449This choice helps achieve uniform end treatment and TODO finish summarizing benefit.
450A link pointer targets a neighbouring @dlink@ structure, rather than a neighbouring @req@.
451(Recall, the running example has the user putting a @dlink@ within a @req@.)
452
453\begin{figure}
454 \centering
455 \includegraphics{lst-impl-links.pdf}
456 \caption{
457 \CFA list library representations for the cases under discussion.
458 }
459 \label{fig:lst-impl-links}
460\end{figure}
461
462Link pointers are internally tagged according to whether the link is user-visible.
463Links among user-requested neighbours are left natural, with the tag bit not set.
464System-added links, which produce the circular implementation, have the tag bit set.
465Iteration reports ``has more elements'' when crossing natural links, and ``no more elements'' upon reaching a tagged link.
466
467In a headed list, the list head (@dlist(req)@) acts as an extra element in the implementation-level circularly-linked list.
468The content of a @dlist@ is a (private) @dlink@, with the @next@ pointer purposed for the first element, and the @prev@ pointer purposed for the last element.
469Since the head wraps a @dlink@, since a @req@ does too, and since a link-pointer targets a @dlink@, the resulting cycle is among @dlink@ structures, situated inside of other things.
470The tags on the links say what the wrapper is: untagged (user link) means the targeted @dlink@ is within a @req@, while tagged (system link) means the targeted @dlink@ is within a list head.
471
472In a headless list, the circular backing list is only among @dlink@s within @req@s. The tags are set on the links that a user cannot navigate.
473
474No distinction is made between an unlisted item under a headed model and a singleton list under a headless model. Both are represented as an item referring to itself, with both tags set.
475
476
477
478\section{Future Work}
479\label{toc:lst:futwork}
480
481The \CFA list examples elide the \lstinline{P9_EMBEDDED} annotations that (TODO: xref P9E future work) proposes to obviate.
482Thus, these examples illustrate a to-be state, free of what is to be historic clutter.
483The elided portions are immaterial to the discussion and the examples work with the annotations provided.
484The \CFA test suite (TODO:cite?) includes equivalent demonstrations, with the annotations included.
485\begin{cfa}
486struct mary {
487 float anotherdatum;
488 inline dlink(mary);
489};
490struct fred {
491 float adatum;
492 inline struct mine { inline dlink(fred); };
493 inline struct yours { inline dlink(fred); };
494};
495\end{cfa}
496like in the thesis examples. You have to say
497\begin{cfa}
498struct mary {
499 float anotherdatum;
500 inline dlink(mary);
501};
502P9_EMBEDDED(mary, dlink(mary))
503struct fred {
504 float adatum;
505 inline struct mine { inline dlink(fred); };
506 inline struct yours { inline dlink(fred); };
507};
508P9_EMBEDDED(fred, fred.mine)
509P9_EMBEDDED(fred, fred.yours)
510P9_EMBEDDED(fred.mine, dlink(fred))
511P9_EMBEDDED(fred.yours, dlink(fred))
512\end{cfa}
513like in tests/list/dlist-insert-remove.
514Future work should autogen those @P9_EMBEDDED@ declarations whenever it sees a plan-9 declaration.
515The exact scheme chosen should harmonize with general user-defined conversions.
516
517Today's P9 scheme is: mary gets a function `inner returning this as dlink(mary).
518Fred gets four of them in a diamond.
519They're defined so that `inner is transitive; i.e. fred has two further ambiguous overloads mapping fred to dlink(fred).
520The scheme allows the dlist functions to give the assertion, "we work on any T that gives a `inner to dlink(T)."
521
522
523TODO: deal with: A doubly linked list is being designed.
524
525TODO: deal with: Link fields are system-managed.
526Links in GDB.
527
Note: See TracBrowser for help on using the repository browser.