Abstract Wikipedia/Type conversion
This page documents type conversion (both explicit and default) in the executors.
Type conversion is what allows potentially verbose ZObject
s to be represented in more accessible and familiar ways within the code executors.
For example, the Wikifunctions `Typed Map` type, in normal form, looks like
{
"Z1K1": {
"Z1K1": "Z9",
"Z9K1": "Z7"
},
"Z7K1": {
"Z1K1": "Z9",
"Z9K1": "Z883"
},
"Z883K1": {
"Z1K1": "Z9",
"Z9K1": "Z6"
},
"Z883K2": {
"Z1K1": "Z9",
"Z9K1": "Z6"
}
}
and a simple `Typed Map` instance can easily run to hundreds of lines.
In JavaScript, these objects are automatically converted into Map
s; in Python, they become dict
s. This makes it much easier and more intuitive for implementers to work with data in the way that's most natural for their chosen programming language.
Current Status
editThe function executors in Python and JavaScript support default conversion for some built-in types. They also support custom type conversion for community-defined types.