Skip to content

Commit 21d1c3d

Browse files
committed
WIP -- cleanups for language differences and extensions
1 parent 7cb1d65 commit 21d1c3d

File tree

3 files changed

+40
-37
lines changed

3 files changed

+40
-37
lines changed

documentation/source/library-reference/language-extensions/for-iteration.rst

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
Extensions to the FOR iteration construct
2-
-----------------------------------------
1+
.. index:: pair: for; keyed-by
2+
.. index:: pair: for; using
3+
4+
Extensions to the FOR iteration macro
5+
-------------------------------------
36

47
We have also made two extensions to the ``for`` iteration construct: a
5-
``keyed-by`` clause and ``in using`` clauses.
8+
``keyed-by`` clause and ``in ... using`` clauses.
69

710
The ``keyed-by`` clause allows iteration over table elements:
811

@@ -12,7 +15,7 @@ The ``keyed-by`` clause allows iteration over table elements:
1215
...
1316
end;
1417
15-
The ``in using`` clause allows you to specify a iteration protocol
18+
The ``in ... using`` clause allows you to specify a iteration protocol
1619
other than the default (:drm:`forward-iteration-protocol`):
1720

1821
.. code-block:: dylan

documentation/source/library-reference/language-extensions/index.rst

+15-12
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,24 @@
22
Dylan Language Extensions
33
*************************
44

5-
The Dylan language is described in `The Dylan Reference Manual
6-
<https://opendylan.org/books/drm/>`_ by Andrew Shalit (Addison-Wesley,
7-
1996). We call this book "the DRM" hereafter.
5+
.. TODO: how do the ../dylan/ documents (finalization, primitives, threads) fit in?
6+
.. TODO: what about simple-profiling, simple-timing, byte-vector, threads, ...?
87
9-
Open Dylan provides an implementation of the Dylan language
10-
described by the DRM, with a few exceptions that are documented in
11-
:doc:`language-differences`.
8+
.. current-library:: common-dylan
9+
.. current-module:: common-dylan
1210

13-
Open Dylan provides the Dylan language in the ``dylan`` module of the
14-
``dylan`` library.
11+
The Dylan language is described in the :drm:`Dylan Reference Manual <Title>` by
12+
Andrew Shalit (Addison-Wesley, 1996), hereafter referred to as "the DRM".
1513

16-
This document is an introduction to Open Dylan's extensions to the
17-
Dylan language. These extensions are either built in to the ``dylan``
18-
library or are available in a separate library, :doc:`common-dylan
19-
<../common-dylan/index>`.
14+
The ways in which Open Dylan differs from the DRM are documented in
15+
:doc:`language-differences`. The rest of this document describes features added
16+
to the language while retaining compatibility with the DRM. These extensions
17+
are either built in to the ``dylan`` library or are available in a separate
18+
library, :doc:`common-dylan <../common-dylan/index>`.
19+
20+
The :doc:`common-dylan <../common-dylan/index>` library exports the
21+
:mod:`common-dylan:common-dylan` module and several other very frequently used
22+
modules.
2023

2124
The majority of the extensions are in the :doc:`common-extensions
2225
<../common-dylan/common-extensions>` module

documentation/source/library-reference/language-extensions/language-differences.rst

+18-21
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Language Differences
44
.. current-library:: dylan
55
.. current-module:: dylan
66

7+
This document describes the ways in which Open Dylan differs from the
8+
specification in the :drm:`Dylan Reference Manual <Title>`.
9+
710
Note that in addition to the intentional differences documented below, there
811
are several `known bugs
912
<https://github.com/dylan-lang/opendylan/issues?q=is%3Aissue+is%3Aopen+label%3ADRM>`_
@@ -23,8 +26,7 @@ achieved by returning the argument *hash-state* unchanged as the result
2326
protocol.
2427

2528
This section describes the items that have been changed. We also provide
26-
a Table-extensions module, which you can read about in
27-
:doc:`../collections/table-extensions`.
29+
a :doc:`table-extensions module <../collections/table-extensions>`.
2830

2931
.. generic-function:: table-protocol
3032
:open:
@@ -42,15 +44,15 @@ a Table-extensions module, which you can read about in
4244
Returns the functions used to iterate over tables. These functions are
4345
in turn used to implement the other collection operations on :drm:`<table>`.
4446

45-
The *test-function* argument is for the table test function, which is
47+
The *test-function* return value is for the table test function, which is
4648
used to compare table keys. It returns true if, according to the table's
4749
equivalence predicate, the keys are members of the same equivalence
4850
class. Its signature must be::
4951

5052
test-function *key1* *key2* => *boolean*
5153

52-
The *hash-function* argument is for the table hash function, which
53-
computes the hash code of a key. Its signature must be::
54+
The *hash-function* return value must compute the hash code of a key. Its
55+
signature must be::
5456

5557
hash-function *key* *initial-state* => *id* *result-state*
5658

@@ -60,8 +62,8 @@ a Table-extensions module, which you can read about in
6062
hash code is returned as two values: an integer *id* and a hash-state
6163
*result-state*. This *result-state* is obtained by merging the
6264
*initial-state* with the hash-state that results from hashing *key*.
63-
The *result-state* may or may not be == to *initial-state*. The
64-
*initial-state* could be modified by this operation.
65+
The *result-state* may or may not be :drm:`==` to *initial-state*. The
66+
*initial-state* may be modified by this operation.
6567

6668
.. function:: merge-hash-ids
6769

@@ -81,20 +83,15 @@ a Table-extensions module, which you can read about in
8183
generate a hash ID for an object by combining hash IDs of some of
8284
its parts.
8385

84-
The *id1*, *id2* arguments and the return value *merged-id* are all
85-
integers.
86-
87-
The *ordered* argument is a boolean, and determines whether the
88-
algorithm used to the merge the IDs is permitted to be
89-
order-dependent. If false (the default), the merged result must be
90-
independent of the order in which the arguments are provided. If
91-
true, the order of the arguments matters because the algorithm used
92-
need not be either commutative or associative. It is best to
93-
provide a true value for *ordered* when possible, as this may
94-
result in a better distribution of hash IDs. However, *ordered*
95-
must only be true if that will not cause the hash function to
96-
violate the second constraint on hash functions, described on page
97-
:drm:`123 of the DRM <Tables#XREF-1049>`.
86+
The *ordered* argument determines whether the algorithm used to merge the
87+
IDs is permitted to be order-dependent. If false (the default), the merged
88+
result must be independent of the order in which the arguments are
89+
provided. If true, the order of the arguments matters because the
90+
algorithm used need not be either commutative or associative. It is best
91+
to provide a true value for *ordered* when possible, as this may result in
92+
a better distribution of hash IDs. However, *ordered* must only be true if
93+
that will not cause the hash function to violate the second constraint on
94+
hash functions, :drm:`described in the DRM <Tables#XREF-1049>`.
9895

9996
.. function:: object-hash
10097

0 commit comments

Comments
 (0)