Wikifunctions:Reserved ZIDs

From Wikifunctions
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

Tracked in Phabricator:
Task T258914

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/Type
  • Z200 – 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 now
  • Z400 – Z499: reserved for local use
  • Z500 – Z599: core error types (Z5xx because Z5 is error) (See § Core error types below.)
  • Z600 – Z699: core programming languages (Z6xx because Z61 is programming language)
  • Z700 – Z799: unassigned for now
  • Z800 – Z899: definitions of core functions with built-ins (Z8xx because Z8 is function) (See § Core functions below.)
  • Z900 – Z999: built-ins for the core functions (they are +100 from the respective Z8xx)
  • Z1000 – Z1999: natural languages (instances of Z60)
  • Z2000 – Z6999: reserved for future use
  • Z7000 – Z7999: experimental, used for NLG, will be changed
  • Z8000 – 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 a Z2, 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 to Z8.
  • 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 of Z11.
  • 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 of Z31.
  • 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 is Z5.
  • Z60: Natural language (Type): because Z6 is a string.
  • Z61: Programming language (Type): because Z16 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

  • Z801Echo: T ➝ T
    returns the input unchanged
  • Z802If: Boolean, T, T ➝ T
    returns second argument if the first is true, else the third; if has two letters
  • Z803Value by key: Key reference, Any ➝ Any
    returns the value by key from the object; Z3/Key
  • Z805Reify: 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.
  • Z881Typed list: Type ➝ Type
    takes a type and returns a type of a list of elements of that type
  • Z882Typed pair: Type, Type ➝ Type
    takes two types and returns a type representing a pair of these
  • Z883Map: … ➝ …
  • Z884Union: T, T ➝ T
    takes two types and returns a type that accepts either
  • Z885Error type to type: Error type ➝ Type
    takes an error type and creates a type out of it
  • Z886Convert: List*(Character) ➝ String
    convert a list of Characters into a string, because Z86/Character and Z6/String.
  • Z887Reduce: … ➝ …
  • 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 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
  • Z509 (errors): List of errors
  • 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
  • Z517 (expected type, actual type, returned value, propagated error): Return type mismatch
  • Z518 (expected type, object, propagated error): Object type mismatch
  • Z519 (object): Undefined list type
  • Z520 (object): Wrong list type
  • 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
  • Z552 (index, expected type, actual type): array element type mismatch
  • Z553 (zobject): disallowed root type
  • Z554 (clashing ZID, language): label clashes with another ZObject's label
  • Z555 (ZID, title): mis-matched ZID and page title
  • Z556 (title): invalid page title
  • Z557 (error message): user does not have permission
  • Z558 (programming language): invalid programming language
  • Z559 (none): user not permitted to evaluate function
  • Z560 (evaluation result): invalid evaluation result
  • Z561 (propagated error): invalid evaluation request
  • Z562 (missing property): incomplete evaluation request
  • Z563 (call): call by non-reentrant executor
  • Z564 (contents): invalid executor response
  • Z565 (missing property): Incomplete executor request
  • Z570 (orchestrator rate limit): reached rate limit in orchestrator
  • Z571 (evaluator rate limit): reached rate limit in evaluator
  • Z572 (recursion limit, function name): reached recursion limit in orchestrator
  • Z573 (recursion limit, function name): reached recursion limit in evaluator
  • Z574 (time limit): reached time limit in orchestrator
  • Z575 (time limit): reached time limit in evaluator


See also