proposals

Formal proposals for changes to the code, new libraries, etc.

View the Project on GitHub

Lists

Lists are a core, syntactic type. The basic syntax, for reference, is:

# Elements on the same line must be separated by a comma:
[first element, second element, ...]

# But newlines are also an element separator:
[
    first element
    second element
    ...
]

However this document is for discussing them as a struct, rather than their syntax.

Keys

each is an alias of type intended to be used when referencing, tying into the cloning system. That is, type is cloned for each entry in the list, so referencing it causes the referencer to be cloned for each entry in the list.

List of serializables

If type is strictly defined as a serializable type, the list is also serializable. Thus it can be placed as a child of a serializable only in that case. It assumes all the elements are serialized sequentially, thus they must have a deterministic size when the list is meant to be un/serialized directly.

This should hold true for any linearly ordered types. Entries in a list cannot define base.

Formatting

While lists cannot be used in a string context generically, they can be used in structs which can be stringified, such as in JSON or as an XML element’s list of children. Of course it can also be stringified as RPL.

While these options have no business being specified in the structure, they could fall under whatever pretty-printing system is implemented. The options may be more prudent on JSON etc types directly in terms of where they’re implemented, but it’s important to have some level of standardization between all the methods of stringification.

Future

Semantics

There are multiple types of lists or collections in this world, and sometimes it can be important to know what kind you intend, since list generically represents all of them. While this could be done via types which inherit from list I believe the notions can be split into properties as well.

From theory we have sets, bags, lists, arrays, matrices, vectors, sequences, tuples, queues, stacks. Arrays and matrices can be multi-dimensional, but looking at only single-dimensional options, it’s often unnecessary to distinguish between many of these terms. Additionally they can mean different things in different programming languages which can make it too confusing to refer to them by name.

From common programming paradigms, I would also like to suggest foreach type lists. These are lists meant to be run in a map call, essentially; where a function is applied to each element. There are multiple common use cases here, though. It could be like map (a transformation of every element), or a reduction (run a function on the first element (or take the raw first element), then pass that result and the next element into the function, etc) or it could be like a list of ports that are available for you to listen on where you only want one of them (the first one you pull out that works), or possibly other scenarios.

Some other potential types of lists might be argument lists (each element has a position, type, meaning, and name; and they’re meant for a specific function probably), the result of a taxonomical descent ([gparent, parent, this] type thing), …

Theoretical definitions

As properties