Code Monkey home page Code Monkey logo

Comments (2)

Dekkonot avatar Dekkonot commented on September 17, 2024

It turns out that Enum attributes require us to store the name of the Enum that the EnumItem we're referring to is a part of. This makes sense, in hindsight, but it means that supporting these is going to be potentially complex since we have to start tagging enums with their names in some capacity.

My thoughts are that we modify the Enum type in rbx_types to also hold an Option<String> (or something akin to that) and then rbx_binary and rbx_xml (and other consumers) can fill that in if necessary. Then when serializing enums, we would raise an error if it didn't a name. It feels appropriately simple and doesn't require us to pull reflection info into anywhere new.

from rbx-dom.

Dekkonot avatar Dekkonot commented on September 17, 2024

Okay I have bad news: Serde's derive macro is not powerful enough to accomplish what I was hoping to above. This means we'll have to implement a potentially complex serializer and deserializer for Enums if we use the existing struct.

My main concern is that Rojo users rely upon the serde format for enums to be stable, so the easy solutions are out the window: if we represent Enum as a struct instead of a newtype, it breaks the serde format.

It's also possible I have massively overcomplicated things so I'm interested to hear others thoughts on it.

from rbx-dom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.