Open kyleoneill opened 10 months ago
Somewhat resolved by https://github.com/kyleoneill/chimerascript/pull/34. Literal has been broken up and Data
no longer implements PartialEq
, but the struct that it contains does and can still panic if an equality check is made for a collection while a mutable reference for a value contained within it is out.
This might just be an impossible to resolve structural issue with how referencing is currently handled. This can be resolved by moving to another reference system, like the variable hashmap being HashMap<String, usize>
where the usize
is an address in some Vec<T>
which actually stores all of the data in some global MutRef
. All data in this case would be behind a single reference, which solves this issue and brings others.
If stricter guards are placed around getting a mutable reference to make sure it's impossible to have one out when reading, that could also be a solution.
Implementing the reference change, I ran into an issue where the collection variants of the
Literal
enum causedData
to have to implementPartialEq
. This is a problem.Literal
must implementPartialEq
and this implementation should not be spilling intoData
as it can cause a panic if an equality check is made in the right scenario. Theeq
method ofPartialEq
cannot return a result.Will likely need to split
Literal
again into an enum with one variant that holds the string, num, bool, sub-variants and another which holds the object and list sub-variants. The serde Deserialize derive will have to be swapped over