Skip to content

Allow pre-parsed config objects to custom types #34

@WebReflection

Description

@WebReflection

While there's more happening in this MR pyscript/pyscript#1698 that's not worth explaining in here, it became evident custom types might pass a config reference that is already an object literal, not a string.

Currently, the config is also used to define the unique identity of any interpreter bootstrap, but this assumption fails short with custom types, because these are all based on the initial config that's passed along, at least on the main thread (workers can have random configs without issues because workers are all unique by design/default).

My concern is that it shouldn't be needed to re-parse a config when such config has already been parsed or sent as object literal to define the custom type, but current logic makes that assumption and, in the worst case scenario, we JSON.parse(config) twice which is definitively not a real bottleneck, but it feels unnecessary, hence there's room for improvements.

Note keep in mind the config is needed to also resolve the URL of the running code and provide safe defaults to the rest of the logic so this is effectively a low priority but definitively a nice to have improvement around polyscript custom-types logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions