1.1 --- a/docs/wiki/Design Wed Jun 23 01:52:42 2021 +0200
1.2 +++ b/docs/wiki/Design Sun Jun 27 19:29:37 2021 +0200
1.3 @@ -697,3 +697,38 @@
1.4 the appropriate parameter of this nature, but programmers could just write
1.5 functions and methods that employ general sequence and mapping parameters
1.6 explicitly instead.
1.7 +
1.8 +== Library and Built-In Types ==
1.9 +
1.10 +{{{#!table
1.11 +'''Lichen''' || '''Python''' || '''Rationale'''
1.12 +==
1.13 +Integers belong to the `integer` type
1.14 +|| Integers are represented using the `int` type
1.15 +|| The `int` callable cannot be used to construct integer values in Lichen
1.16 +==
1.17 +Strings belong to the `string` or `utf8string` types
1.18 +|| Strings are represented using the `str` or `unicode` types
1.19 +|| Separate `str` and `unicode` functions perform conversion to string types
1.20 +}}}
1.21 +
1.22 +=== Integer Type ===
1.23 +
1.24 +In Python, the `int` callable is largely used to convert other types to
1.25 +integers. However, it is also used to test whether instances are integers, and
1.26 +the callable is, in fact, a form of constructor. Since Lichen only supports
1.27 +the definition of initialisers (`__init__`) and not more exotic callables such
1.28 +as `__new__`, which would permit more control over the construction of
1.29 +instances, it cannot easily provide the necessary functionality to redefine
1.30 +the nature of an instance, at least in the case of integers whose identities
1.31 +are their values, which applies in Lichen because tagged values are used in
1.32 +place of integer instances, and thus the "virtual" instance being initialised
1.33 +would actually need to be exchanged instead of being changed in some way.
1.34 +
1.35 +=== String Types ===
1.36 +
1.37 +Similarly, in Python, the `str` and `unicode` callables both convert and
1.38 +construct new instances as well as acting as types. Although an initialiser
1.39 +could be written to mutate the value retained by such instances in Lichen,
1.40 +this precludes the obvious definition of a `str` function as merely a wrapper
1.41 +around the invocation of the `__str__` method of any given object.
2.1 --- a/docs/wiki/Representations Wed Jun 23 01:52:42 2021 +0200
2.2 +++ b/docs/wiki/Representations Sun Jun 27 19:29:37 2021 +0200
2.3 @@ -54,12 +54,12 @@
2.4 obtaining an instance under normal circumstances, instead provides the address
2.5 of a common integer instance. This instance may then provide instance
2.6 attributes, whose values will be the same for all integers, or class
2.7 -attributes through a reference to the integer (`int`) class.
2.8 +attributes through a reference to the `integer` class.
2.9
2.10 -Each method provided by `int`, when called, will be given the original
2.11 +Each method provided by `integer`, when called, will be given the original
2.12 attribute for which the method was obtained as its context. In such methods,
2.13 -operations on the context via `self` will either involve the propagation of
2.14 -the attribute to other functions or methods or attribute accesses on `self`,
2.15 +operations on the context via `self` will either involve the propagation of the
2.16 +attribute to other functions or methods or attribute accesses on `self`,
2.17 yielding common instance attributes or class attributes as already described.
2.18 Only native functions will attempt to interpret the attribute in a different
2.19 way, decoding the representation, performing arithmetic or logical operations,
3.1 --- a/docs/wiki/ToDo Wed Jun 23 01:52:42 2021 +0200
3.2 +++ b/docs/wiki/ToDo Sun Jun 27 19:29:37 2021 +0200
3.3 @@ -14,14 +14,14 @@
3.4
3.5 === Numeric Types ===
3.6
3.7 -Support all the numeric types. Currently, only `int` is supported, but `float`
3.8 -merely requires some native code handling operations and testing for exception
3.9 -conditions. A representation for `long` needs to be determined, and `complex`
3.10 -probably just needs some methods implementing.
3.11 +Support all the numeric types. Currently, only `int` is supported (as
3.12 +`integer`), but `float` merely requires some native code handling operations
3.13 +and testing for exception conditions. A representation for `long` needs to be
3.14 +determined, and `complex` probably just needs some methods implementing.
3.15
3.16 -Support promotion between some of the numeric types. Currently, `int` values
3.17 -that overflow raise `OverflowError`, as was done in Python before automatic
3.18 -promotion to `long`.
3.19 +Support promotion between some of the numeric types. Currently, `integer`
3.20 +values that overflow raise `OverflowError`, as was done in Python before
3.21 +automatic promotion to `long`.
3.22
3.23 === String Types ===
3.24