PropertyKey does not accurately check conversions from Strings
Opened this issue · 0 comments
We rely on an assumption that number-like PropertyKey
s 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.