Comments (4)
We probably don't want to serialize Archivable to begin with, but I don't want to mark properties unnecessarily as non-serializable, so 2 is the best option IMO.
I think the idea of Roblox deserializing Instance.archivable
is really funny though. Under what circumstances would that even come up, ha ha?
from rbx-dom.
After giving this a shot, I've ran into a minor hiccup: the way we handle default properties is per-class right now. This means that in order to override a default for an abstract class like Instance
, we'd need to override it for every class that inherits from it. That's a much bigger change than I was hoping for due to the nature of Instance
.
I don't really have any good ideas to fix this. I have no problem cascading patches down to every inherited class, but it would mean we'd need to be careful with new patches to Instance
's defaults since every one would result in a rather large addition to the database.
from rbx-dom.
It is a little weird how we that information duplicated... but maybe instead of adding the default value patches to all subclasses, we could change the way rbx_binary's serializer finds default properties? e.g., replace this:
rbx-dom/rbx_binary/src/serializer/state.rs
Lines 401 to 403 in f6007d5
with a call to a function like:
fn find_default_value(
database: &'db ReflectionDatabase,
mut class: &'db ClassDescriptor<'db>,
canonical_property_name: &str,
) -> Option<&'db Variant> {
loop {
match class.default_properties.get(canonical_property_name) {
None => {
class = database
.classes
.get(class.superclass.as_deref()?)
.expect("superclass that is Some should exist in reflection database")
}
default_value => return default_value,
}
}
}
We wouldn't have to move any existing defaults if we did this (although it's probably a good idea to deduplicate all the defaults in the future), but it would work with the obvious implementation of property default value patches
from rbx-dom.
Downside: more overhead for inherited properties (especially if we eventually do move default property values into their respective classes), since this does multiple hashmap lookups for each inherited property
from rbx-dom.
Related Issues (20)
- Concretely define and use terms like `alias`, `canonical`, etc.
- Support more than one root-level Instance in rbx_dom_weak
- rbx_reflector is inconsistent with storing default values for properties HOT 1
- rbx_reflector does not read Studio saving the default place file correctly sometimes
- Releases should be more automated HOT 1
- rbx_dom_lua should be a Wally package HOT 1
- Memory leak in SharedString HOT 10
- `TerrainMaterials` should implement `FromStr`
- Support for `SecurityCapabilities` tag in XML files HOT 1
- Add support for `Enum`-typed attributes HOT 2
- rbx-dom doesn't care about select properties important for correctness and least surprise HOT 7
- `Model.WorldPivotData` needs a custom property setter/getter HOT 2
- Failed to deserialize Configuration.AttributesSerialize HOT 1
- Property write failure warning should include the instance's full name
- Humanoid instances should be serialized last in files
- Serve still incorrectly changes WorldPivotData HOT 1
- `WriteUnknown` behavior in rbx_xml does not respect serialization of known properties
- Small Inconsistency with float & double in Attributes encoding HOT 2
- Documenting the CollisionGroupData property format
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rbx-dom.