Abstract Wikipedia/Type conversion

Abstract Wikipedia via mailing list Abstract Wikipedia on IRC Wikifunctions on Telegram Wikifunctions on Mastodon Wikifunctions on Twitter Wikifunctions on Facebook Wikifunctions on YouTube Wikifunctions website Translate

This page documents type conversion (both explicit and default) in the executors. Type conversion is what allows potentially verbose ZObjects 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 Maps; in Python, they become dicts. 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

edit

The function executors in Python and JavaScript support default conversion for some built-in types. They also support custom type conversion for community-defined types.

Default Conversion

edit

Custom Conversion

edit