The wiki of functions currently loads a few static ZObjects on setup. We will over time need a few more of these.
This page is about the fun bike-shedding discussion of how many ZIDs we should reserve, whether they have to be contiguous, and what these first ZIDs should be. This can also be a place for planting easter eggs, a feature that has proven rather popular in Wikidata.
Note that, in order to simplify the discussion, we currently do not think about the future possibility of having federated instances of the software running the wiki of functions, and how that will work. We are solely thinking about which ZIDs for the wiki of functions itself should be reserved.
There is a certain simplicity in saying “all ZIDs with 4 digits or less are reserved”.
There is also the hybrid model of reserving all ZIDs below a certain number, and additionally reserving some bigger ZIDs for easter eggs or specific reasons (that's what Wikidata did).
Let's reserve all ZIDs with four digits or less.
All core objects would be in the ZIDs with three digits and fewer, and we keep the four-digit ZIDs for languages.
This follows roughly the proposals made by community members on the talk page and on Phabricator. In particular, we also won't pack the space.
We reserve certain spaces for certain kinds of pre-defined objects.
core types. (See § Core types below.)
validators for the core types ( i.e. for each core type, +100 gives the validator), e.g. Z104 is the validator for Z4/Type
built-in implementations for the validators for the core types ( i.e. Z204 is the built-in implementation for the validator for Z4/Type)
reserved for local use
core error types (
Z5 is error)
(See § Core error types below.)
core programming languages (
Z61 is programming language)
definitions of core functions with built-ins (
Z8 is function)
(See § Core functions below.)
built-ins for the core functions (they are +100 from the respective Z8xx)
natural languages (instances of Z60)
reserved for future use
experimental, used for NLG, will be changed
Testers for each pre-defined function ( e.g. Z801 is tested via Z8010, Z8011, Z8012, … Z8019).
reserved for future use
ZObject, the root.
Persistent object (Type): everything on the wiki is a
Z2, that's why this has such a low ZID.
Key (Type): because the word has three letters in English. key
Type (Type): because the word has four letters in English. type
Error (Type): because the word has five letters in English. error (See § Core error types below.)
String (Type): because the word has six letters in English. string
Function call (Type): because function calls are the main magic of the system, and 7 is a magic number. It is also close to
Function (generic type, thus technically a function): because has eight letters in English. function (See § Core functions below.)
Reference (Type): because the word has nine letters in English. reference
List (generic type, thus technically a function): because it's the first number that has two digits.
Monolingual text (Type): because it is just one language, and there's a one in the name.
Multilingual text (Type): because it's an extension of
empty list (List): nature abhors vacuum, and people dislike 13.
Implementation (Type): because the word has fourteen letters in English. implementation
Code (Type): no good reason, it's close to Z14, and Z61/Programming language.
Argument declaration (Type).
Argument reference (Type).
Tester (Type): because 20/20 is perfect vision, and tests make errors visible.
Pair (generic type, thus technically a function): because it's two twos.
Monolingual textset (Type).
Multilingual textset (Type): because it's an extension of
Key reference (Type): because Z3/Key Z9/Reference.
Boolean (Type): because Boole first published in (18)40.
Error type (Type): because Error is
Natural language (Type): because
Z6 is a string.
Programming language (Type): because
Z16 is code.
Byte (Type): because it is an octet.
Code point (Type): because it is not exactly a Z80/Byte, but more like Z6/String.
Quote (Type): because it looks a bit like a closing quotation mark in English.
Echo: T ➝ T
returns the input unchanged
If: Boolean, T, T ➝ T
returns second argument if the first is true, else the third; if has two letters
Value by key: Key reference, Any ➝ Any
returns the value by key from the object; Z3/Key
Reify: Any ➝ List(Pair(Key reference, Any))
transform any object into a list of key-value pairs; reify has five letters
Abstract: List(Pair(Key reference, Any)) ➝ Any
transform a list of key-value pairs into an object; abstract has eight letters.
Prepend element to list: T, List(T) ➝ List(T)
insert an object to the beginning of an ordered list of objects (because Z10 is list).
First element: List(T) ➝ T
get the first item in an ordered list of objects (because Z10 is list and we get the first)
List without first element: List(T) ➝ List(T)
get the list without the first object (because Z10 is list and we get the second, the rest)
Empty: List(T) ➝ Boolean
return if a list does not contain any item (because Z13 is empty list).
Trigger Metadata: Error ➝ Any
take the given error or other metadata and emit it in the function call response envelope.
First: Pair(T1, T2) ➝ T1
extract the first value of a pair (because Z22 is pair).
Second: Pair(T1, T2) ➝ T2
extract the second value of a pair (because Z22 is pair).
Boolean equality: Boolean, Boolean ➝ Boolean
returns true if the two inputs are the same, false otherwise
Language code to language: String ➝ Language
takes a language code given as a string and returns a natural language object
String equality: String, String ➝ Boolean
returns true if the two inputs are the same, false otherwise
Convert: String ➝ List(Character)
convert a string into a list of Characters, because Z6/String and Z86/Character.
Typed list: Type ➝ Type
takes a type and returns a type of a list of elements of that type
Typed pair: Type, Type ➝ Type
takes two types and returns a type representing a pair of these
Map: ... ➝ ...
Union: T, T ➝ T
takes two types and returns a type that accepts either
Error type to type: Error type ➝ Type
takes an error type and creates a type out of it
Convert: List*(Character) ➝ String
convert a list of Characters into a string, because Z86/Character and Z6/String.
Reduce: ... ➝ ...
Same: Character, Character ➝ Boolean
compare two characters and return if they are equal.
Unquote: Quote ➝ Any
Unquotes a ZObject, because Z99/Quote.
Core error types
Z501 (error message, input): syntax error
Z502 (subtype, value): not wellformed, points to Z52x or Z53x
Z503 (function name): not implemented yet
Z504 (zid): Zid not found
Z505 (expected, actual, args): number of arguments mismatch
Z506 (expected, actual, arg): argument type mismatches
Z507 (function call): error in evaluation
Z508 (object): competing keys
Z510 (none): nil
Z511 (key reference, object): key not found
Z512 (object): Z9 error
Z513 (resolved object): resolved object without Z2K2
Z514 (implementation): Builtin does not exist
Z515 (implementation): Builtin ID is erroneous
Z516 (key, bad value): Argument value error
Z521 (offending value): ZObjects must not be number or boolean or null
Z522 (offending index in array, propagated error): Array element not well formed
Z523 (object): Missing Z1K1
Z524 (value of Z1K1): Z1K1 must not be a string or array
Z525 (key): Invalid key
Z526 (key, propagated error): not wellformed value
Z531 (whole object): Z6 must have 2 keys
Z532 (whole object): Z6 without a Z6K1
Z533 (value of Z6K1): Z6K1 must be a string
Z534 (whole object): Z9 must have 2 keys
Z535 (whole object): Z9 without a Z9K1
Z536 (value of Z9K1): Z9K1 must be a string in JSON
Z537 (value of Z9K1): Z9K1 must look like a reference
Z538 (page title): wrong namespace
Z539 (page title): wrong content type
Z540 (language code): invalid language code
Z541 (language code): language code not found
Z542 (expected type, actual object): expected type, actual object
Z543 (type name): type not found
Z544 (type zid, type name, existing type name): conflicting type names
Z545 (type zid, type name, existing type zid): conflicting type Zids
Z546 (type zid, type name): builtin type not found
Z547 (input): invalid format
Z548 (error message, input): invalid JSON
Z549 (reference value): invalid ZReference
Z550 (reference value): unknown ZReference
Z551 (key, expected type, actual type): schema type mismatch
(index, expected type, actual type): array element type mismatch
(zobject): disallowed root type
(clashing ZID, language): label clashes with another ZObject's label
(ZID, title): mis-matched ZID and page title
(title): invalid page title
(error message): user does not have permission
(programming language): invalid programming language