Giter Club home page Giter Club logo

Comments (3)

lloydmeta avatar lloydmeta commented on August 16, 2024 2

Any design should take into consideration the design proposed here lampepfl/dotty#1970

from enumeratum.

LPTK avatar LPTK commented on August 16, 2024

Hello there, just chiming in (a little late, sorry).
I'm quoting the previous, closed issue on the same subject:

One thing I've seen quite often with the annotation-driven enum solutions is that they exchange power/flexibility in exchange for terseness. What this means is that they usually don't support the full myriad of things that Scala allows you to do, like adhock extend other traits/classes in members (e.g. the way we do stacked traits to manipulate names) or add methods and values to each member, which can come in quite handy. By the time you can support all these use-cases, you've probably got a fairly huge and complex macro.

In case you have not seen it yet, I designed a powerful macro-annotation library to express sealed class hierarchies more easily in Scala: boilerless.
Its focus is only on reducing boilerplate, which is orthogonal to the issue of defining enums, so it is completely compatible with enumeratum. I even added a dedicated syntax to make it terser to define enumeratum enums. Have a look here.
On the other hand, it does not remove any flexibility compared to what you can do with Scala (add members, explicit extends clauses, etc.).

from enumeratum.

LPTK avatar LPTK commented on August 16, 2024

Note: despite that, the library is still rather simple, consisting of a single file with 325 LOC (excluding blanks and comments). The logic is admittedly rather complex and the code could be clarified, but there is nothing fundamentally complex about it.

from enumeratum.

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.