Git Product home page Git Product logo

Comments (7)

jeanbza avatar jeanbza commented on September 27, 2024 1

I like Value. It feels like time.Time{}, big.Int{}, etc to me. But, I'm not hugely opinionated - both seem pretty readable imo.

from wire.

zombiezen avatar zombiezen commented on September 27, 2024

@enocom, @tbpg, @jadekler any thoughts?

from wire.

zombiezen avatar zombiezen commented on September 27, 2024

I'm worried about the following edge cases in wire.Value as it exists now:

  1. Referring to a package variable that changes. The declaration makes it seem like it would take on the value from initialization time, but it's actually evaluated when the injector is called (mildly surprising).
  2. There's no way to write an interface-nil expression in a way that could be preserved at runtime. This limits Wire provider sets to being compile-time only.

from wire.

jeanbza avatar jeanbza commented on September 27, 2024

#1 is a bummer, I agree. Could you elaborate on #2? I don't fully grok.

from wire.

zombiezen avatar zombiezen commented on September 27, 2024

Consider an implementation of Wire that does not do code generation, but instead relies on reflection. (There are no plans to do so, but it would be nice to allow this to permit interoperability with other DI libraries.) If you write goose.Value(MyInterface(nil)) to satisfy a dependency on MyInterface, it will work in the gowire code gen tool, but the type information is lost at runtime (this is a subtle point, see Francesc's Understanding Nil for a refresher).

from wire.

jeanbza avatar jeanbza commented on September 27, 2024

Do we not have the same problem regardless of the name? I'm in fairly-unfamiliar and barely-grokking territory though so I may not be the best reviewer heh.

from wire.

zombiezen avatar zombiezen commented on September 27, 2024

I discussed this with @rsc and he came up with a better idea to preserve wire.Value while fixing the more confusing semantics. I've captured this in #104; I'm closing this issue out in favor of that one.

from wire.

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.