Wikfunctions:Reserverade ZID:er
- 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.
Should the reserved ZIDs be contiguous?
Yes.
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).
How many ZIDs should we reserve?
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.
Currently reserved ZIDs
See Wikifunctions:Reserved ZIDs/all for a list of currently pre-defined objects.
Ranges
We reserve certain spaces for certain kinds of pre-defined objects.
Z1
–Z99
: core types. (See § Core types below.)Z100
–Z199
: validators for the core types (i.e. for each core type, +100 gives the validator), e.g. Z104 is the validator for Z4/TypeZ200
–Z299
: built-in implementations for the validators for the core types (i.e. Z204 is the built-in implementation for the validator for Z4/Type)Z300
–Z399
: unassigned for nowZ400
–Z499
: reserved for local useZ500
–Z599
: core error types (Z5xx
becauseZ5
is error) (See § Core error types below.)Z600
–Z699
: core programming languages (Z6xx
becauseZ61
is programming language)Z700
–Z799
: unassigned for nowZ800
–Z899
: definitions of core functions with built-ins (Z8xx
becauseZ8
is function) (See § Core functions below.)Z900
–Z999
: built-ins for the core functions (they are +100 from the respective Z8xx)Z1000
–Z2999
: natural languages (instances of Z60)Z3000
–Z5999
: reserved for future useZ6000
–Z6999
: types, functions, etc. for using content from Wikidata and other Wikimedia sourcesZ6000
–Z6099
: types for content from Wikidata and other Wikimedia sourcesZ6100
–Z6199
: validators for these typesZ6200
–Z6299
: built-in implementations of the validatorsZ6800
–Z6899
: helper functions for these types that need to be built-in (e.g., fetching, equality)Z6900
–Z6999
: built-in implementations of the helper functions
Z7000
–Z7999
: reserved for future useZ8000
–Z8999
: Testers for each pre-defined function (e.g. Z801 is tested via Z8010, Z8011, Z8012, … Z8019).Z9000
–Z9999
: reserved for future use
Core types
Z1
: ZObject, the root.Z2
: Persistent object (Type): everything on the wiki is aZ2
, that's why this has such a low ZID.Z3
: Key (Type): because the word key has three letters in English.Z4
: Type (Type): because the word type has four letters in English.Z5
: Error (Type): because the word error has five letters in English. (See § Core error types below.)Z6
: String (Type): because the word string has six letters in English.Z7
: Function call (Type): because function calls are the main magic of the system, and 7 is a magic number. It is also close toZ8
.Z8
: Function (generic type, thus technically a function): because function has eight letters in English. (See § Core functions below.)Z9
: Reference (Type): because the word reference has nine letters in English.Z10
: List (generic type, thus technically a function): because it's the first number that has two digits.Z11
: Monolingual text (Type): because it is just one language, and there's a one in the name.Z12
: Multilingual text (Type): because it's an extension ofZ11
.Z13
: empty list (List): nature abhors vacuum, and people dislike 13.Z14
: Implementation (Type): because the word implementation has fourteen letters in English.Z15
: Not yet assigned.Z16
: Code (Type): no good reason, it's close to Z14, and Z61/Programming language.Z17
: Argument declaration (Type).Z18
: Argument reference (Type).Z19
: Not yet assigned.Z20
: Tester (Type): because 20/20 is perfect vision, and tests make errors visible.Z21
: Unit (Type).Z22
: Evaluation result (Type).Z23
: Nothing (Type).Z24
: void (Unit).Z25
: Not yet assigned.Z26
: Not yet assigned.Z27
: Not yet assigned.Z28
: Not yet assigned.Z29
: Not yet assigned.Z30
: Not yet assigned.Z31
: Monolingual textset (Type).Z32
: Multilingual textset (Type): because it's an extension ofZ31
.Z33
: Not yet assigned.Z34
: Not yet assigned.Z35
: Not yet assigned.Z36
: Not yet assigned.Z37
: Not yet assigned.Z38
: Not yet assigned.Z39
: Key reference (Type): because Z3/Key Z9/Reference.Z40
: Boolean (Type): because Boole first published in (18)40.Z41
: true (Boolean).Z42
: false (Boolean).Z43
: Not yet assigned.Z44
: Not yet assigned.Z45
: Not yet assigned.Z46
: Not yet assigned.Z47
: Not yet assigned.Z48
: Not yet assigned.Z49
: Not yet assigned.Z50
: Error type (Type): because Error isZ5
.Z60
: Natural language (Type): becauseZ6
is a string.Z61
: Programming language (Type): becauseZ16
is code.Z80
: Byte (Type): because it is an octet.Z84
: Union (Type).Z85
: Not yet assigned.Z86
: Code point (Type): because it is not exactly a Z80/Byte, but more like Z6/String.Z99
: Quote (Type): because it looks a bit like a closing quotation mark in English.
Core functions
Z801
Echo: T ➝ T- returns the input unchanged
Z802
If: Boolean, T, T ➝ T- returns second argument if the first is true, else the third; if has two letters
Z803
Value by key: Key reference, Any ➝ Any- returns the value by key from the object; Z3/Key
Z805
Reify: Any ➝ List(Pair(Key reference, Any))- transform any object into a list of key-value pairs; reify has five letters
Z808
Abstract: List(Pair(Key reference, Any)) ➝ Any- transform a list of key-value pairs into an object; abstract has eight letters.
Z810
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).
Z811
First element: List(T) ➝ T- get the first item in an ordered list of objects (because Z10 is list and we get the first)
Z812
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)
Z813
Empty: List(T) ➝ Boolean- return if a list does not contain any item (because Z13 is empty list).
Z820
Trigger Metadata: String, Any ➝ Any- take the given value (an error or other metadata) and emits it in the function call response envelope under the name of the String input.
Z821
First: Pair(T1, T2) ➝ T1- extract the first value of a pair (because Z22 is pair).
Z822
Second: Pair(T1, T2) ➝ T2- extract the second value of a pair (because Z22 is pair).
Z844
Boolean equality: Boolean, Boolean ➝ Boolean- returns true if the two inputs are the same, false otherwise
Z860
Language code to language: String ➝ Language- takes a language code given as a string and returns a natural language object
Z866
String equality: String, String ➝ Boolean- returns true if the two inputs are the same, false otherwise
Z868
Convert: String ➝ List(Character)- convert a string into a list of Characters, because Z6/String and Z86/Character.
Z873
Map: Function, List ➝ List- Returns a list where each of the Z1/objects of an input Z881/List has been processed by the given Z8/Function
Z876
Reduce: Function, List, Object ➝ Object- Returns a value after running the given Function on each object of the List, starting with the given Object
Z868
Convert: String ➝ List(Character)- convert a string into a list of Characters, because Z6/String and Z86/Character.
Z881
Typed list: Type ➝ Type- takes a type and returns a type of a list of elements of that type
Z882
Typed pair: Type, Type ➝ Type- takes two types and returns a type representing a pair of these
Z883
Map: … ➝ …- …
Z884
Union: T, T ➝ T- takes two types and returns a type that accepts either
Z885
Error type to type: Error type ➝ Type- takes an error type and creates a type out of it
Z886
Convert: List*(Character) ➝ String- convert a list of Characters into a string, because Z86/Character and Z6/String.
Z887
Reduce: … ➝ …- …
Z888
Same: Character, Character ➝ Boolean- compare two characters and return if they are equal.
Z899
Unquote: Quote ➝ Any- Unquotes a ZObject, because Z99/Quote.
Core error types
Z501
(error message, input): syntax errorZ502
(subtype, value): not wellformed, points to Z52x or Z53xZ503
(function name): not implemented yetZ504
(zid): Zid not foundZ505
(expected, actual, args): number of arguments mismatchZ506
(expected, actual, arg): argument type mismatchesZ507
(function call): error in evaluationZ508
(object): competing keysZ509
(errors): List of errorsZ510
(none): nilZ511
(key reference, object): key not foundZ512
(object): Z9 errorZ513
(resolved object): resolved object without Z2K2Z514
(implementation): Builtin does not existZ515
(implementation): Builtin ID is erroneousZ516
(key, bad value): Argument value errorZ517
(expected type, actual type, returned value, propagated error): Return type mismatchZ518
(expected type, object, propagated error): Object type mismatchZ519
(object): Undefined list typeZ520
(object): Wrong list typeZ521
(offending value): ZObjects must not be number or boolean or nullZ522
(offending index in array, propagated error): Array element not well formedZ523
(object): Missing Z1K1Z524
(value of Z1K1): Z1K1 must not be a string or arrayZ525
(key): Invalid keyZ526
(key, propagated error): not wellformed valueZ531
(whole object): Z6 must have 2 keysZ532
(whole object): Z6 without a Z6K1Z533
(value of Z6K1): Z6K1 must be a stringZ534
(whole object): Z9 must have 2 keysZ535
(whole object): Z9 without a Z9K1Z536
(value of Z9K1): Z9K1 must be a string in JSONZ537
(value of Z9K1): Z9K1 must look like a referenceZ538
(page title): wrong namespaceZ539
(page title): wrong content typeZ540
(language code): invalid language codeZ541
(language code): language code not foundZ542
(expected type, actual object): expected type, actual objectZ543
(type name): type not foundZ544
(type zid, type name, existing type name): conflicting type namesZ545
(type zid, type name, existing type zid): conflicting type ZidsZ546
(type zid, type name): builtin type not foundZ547
(input): invalid formatZ548
(error message, input): invalid JSONZ549
(reference value): invalid ZReferenceZ550
(reference value): unknown ZReferenceZ551
(key, expected type, actual type): schema type mismatchZ552
(index, expected type, actual type): array element type mismatchZ553
(zobject): disallowed root typeZ554
(clashing ZID, language): label clashes with another ZObject's labelZ555
(ZID, title): mis-matched ZID and page titleZ556
(title): invalid page titleZ557
(error message): user does not have permissionZ558
(programming language): invalid programming languageZ559
(none): user not permitted to evaluate functionZ560
(evaluation result): invalid evaluation resultZ561
(propagated error): invalid evaluation requestZ562
(missing property): incomplete evaluation requestZ563
(call): call by non-reentrant executorZ564
(contents): invalid executor responseZ565
(missing property): Incomplete executor requestZ570
(orchestrator rate limit): reached rate limit in orchestratorZ571
(evaluator rate limit): reached rate limit in evaluatorZ572
(recursion limit, function name): reached recursion limit in orchestratorZ573
(recursion limit, function name): reached recursion limit in evaluatorZ574
(time limit): reached time limit in orchestratorZ575
(time limit): reached time limit in evaluator