Giter VIP home page Giter VIP logo

Comments (7)

talios avatar talios commented on June 27, 2024

Would otherwiseLeft and otherwiseFail only be generated for the flavours that support them, or will derive4j have a companion artefact containing an Either and Validation implementation ( hopefully not unique versions of these per @Data type..

from derive4j.

jbgi avatar jbgi commented on June 27, 2024

they would be generated only for flavours that already have those data-types.

from derive4j.

talios avatar talios commented on June 27, 2024

+2 - sounds good.

from derive4j.

elucash avatar elucash commented on June 27, 2024

2cents: why not have overload?

Function<ADT, R> otherwise(R value);
Function<ADT, R> otherwise(Supplier<R> value);

Things are only going bad if you have same erasure or ambiguous lambda parameter (Supplier<Supplier<>> ? unlikely to be used). And the symmetry is not harmed either as naming here is to accommodate return type, not input

from derive4j.

jbgi avatar jbgi commented on June 27, 2024

Yeah, let's try overloading. If not complaints from users' compilers we will keep it. thanks @elucash

from derive4j.

jbgi avatar jbgi commented on June 27, 2024

overloading may not be a good idea, performance-wise. Current inference algo is slow in the presence of overloading: https://bugs.openjdk.java.net/browse/JDK-8051946 / http://stackoverflow.com/questions/34223249/slow-compilation-with-jooq-3-6-plain-sql-and-the-javac-compiler
I also worry that IDE code completion will be less useful.

from derive4j.

jbgi avatar jbgi commented on June 27, 2024

I left out otherwiseFail (Validation ), to reduce the amount of generated code (conversion from Either is easy).
I also gone the overload route. If problems arise overloads may be renamed in a later version.

from derive4j.

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.