Wikifunctions:Type proposals/Wikifunctions object reference
Summary
Follow the pattern used for the various Wikidata references (Z6091, for example) to provide safe (non-dereferencing) references to Wikifunctions objects as well.
Uses
- Prevent the automatic de-referencing of references extracted from Wikifunctions objects (by Z803, for example).
- Allow more straightforward and efficient comparison of types. For example:
- Z16829 (or an equivalent) could return a Wikifunctions object reference rather than a fully expanded type object
- Z19077 extracts a type’s Z4K1 but this is currently expanded back into the referenced type, making type comparisons inefficient
- Z19084 one Python implementation explicitly compares only Z4K1 values, but the types and their references have already been fully expanded by the orchestrator
- “same type reference” would be more efficient, simplifying to Z866
- Z19352
- Z18636
- “type is one of” could be implemented with Z12696
- Simplify search string functions like Z22973, allowing the type reference to be entered as a string, where known.
- Consistent approach across Wikidata and Wikifunctions references, perhaps allowing objects like types to be used in enumerations.
Structure
Like Z6091, Wikifunctions object reference would be a wrapped string, with the string having the form of a Z9.
Example values
A reference to the type Z6001
{
"type": "Wikifunctions object reference",
"value": "Z6001"
}
|
{
"Z1K1": "Z6090",
"Z6090K1": "Z6001"
}
|
Validator
The validator ensures that:
- The string value is a valid Z9
Identity
Two Wikifunctions object references are the same if their string values are equal.
A Wikifunctions object reference is equivalent to a Wikifunctions object if there is a Z2 whose Z2K1 is the same as the value of the Wikifunctions object reference and that Z2 has a value for its Z2K2 that is equivalent to the Wikifunctions object.
Converting to code
Python
Converts in the same way as Z6091 but there might be an explicit Z46 and Z64, if the type does not need to be built in.
JavaScript
Converts in the same way as Z6091 but there might be an explicit Z46 and Z64, if the type does not need to be built in.
Display function
Should be a simple string but can be displayed in the interface as the label of the referenced object (as currently) or as a link to the referenced object (as with Wikidata references)
Read function
Could be a simple string but the use of an object selector should be an option
Alternatives
The alternative is to make Z9 behave properly, but its behaviour would still be inconsistent with Wikidata reference objects, which will be more familiar to most users.
The validator could also ensure that there is a Z2 whose identity is the same string, but this would be inconsistent with the current approach for Wikidata references.
Z6090 is used here as an example, but it would be nice if we could actually use that value,
Comments
Support as proposer. --GrounderUK (talk) 12:14, 10 April 2025 (UTC)
Oppose, name should be "Persistent object reference." Willing to support if this is fixed. Feeglgeef (talk) 11:20, 11 April 2025 (UTC)
Might make fixing Z828 easier
The built-in function Z828 has issues described in phab:T366246 and phab:T366403 with improvements suggested in phab:T366459. Using a wrapped string for the required object reference rather than a quoted reference would probably make these issues easier to resolve. GrounderUK (talk) 22:12, 10 April 2025 (UTC)