Skip to content

Remove PropertyKey from Value, String, Integer, ... conversions in favour of const methods. #183

Open
@aapoalas

Description

@aapoalas

We rely on an assumption that number-like PropertyKeys show up as Integer and that property keys can be compared by-value so that eg. "0" == 0 but the From and TryFrom implementations of PropertyKey do not actually check if strings are number-like.

As a result, ProperyKey::from("0") != PropertyKey::from(0) which is of course not correct.

This sort of points to the direction that the From<Value> and From<String> type of conversions for PropertyKey are invalid: We cannot freely and cheaply convert a string into a PropertyKey without first checking its contents. It would thus be better to remove these String and Value conversions and instead implement functions that do the same but also take an &Agent parameter so as to be capable of checking the string data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomerstechnicalRequires building something new and exciting in Rust

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions