Giter VIP home page Giter VIP logo

Comments (2)

nathanielsimard avatar nathanielsimard commented on May 28, 2024 1

Configs are pretty much raw data that can be serialized and deserialized with proper defaults. I'm not sure there are blockers making it impossible to support generics, but I think using an enum in this setting may be simpler. Anyways, I'm happy to review any PR you do in this direction; simply improving the error message can be beneficial to many!

from burn.

jclmnop avatar jclmnop commented on May 28, 2024 1

Configs are pretty much raw data that can be serialized and deserialized with proper defaults. I'm not sure there are blockers making it impossible to support generics, but I think using an enum in this setting may be simpler. Anyways, I'm happy to review any PR you do in this direction; simply improving the error message can be beneficial to many!

Yeah when I briefly looked over the serde stuff it didn't seem to be impossible, but might not worth the hassle1. In the end, for my specific use case, I just ended up removing generics from the config struct and instead used generics with trait bounds on methods implemented for that config struct and its module.

I'll have more free time early next month, so will probably open a PR to improve error messages related to generics at the very least, and maybe implement generics for #[derive(Config)] after that if it doesn't prove to be too difficult.

One would assume that it shouldn't be too difficult to implement for generics that already implement Config but we'll see.

Footnotes

  1. Could be argued that anything which makes it easier for people to develop their own "extension" crates is worth it, but I really haven't been using burn for long enough to say whether this is one of those features.

from burn.

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.