Coder Social home page Coder Social logo

Comments (6)

vangent avatar vangent commented on May 22, 2024

The README for wire says "It's important to note that the expression will be copied to the injector's package; references to variables will be evaluated during the injector package's initialization." So maybe this is not supported? The error message could be better.

from wire.

zombiezen avatar zombiezen commented on May 22, 2024

Link for sample is broken, and the imports are really relevant here. This sounds like a legit bug, though (the Wire value initialization time stuff is pretty now). Can you check that link?

from wire.

vangent avatar vangent commented on May 22, 2024

The new testcase MultipleSimilarPackages is easily modified to demonstrate this:

vangent/go-cloud@ecd11e6#diff-08ca43f68146628973a3c5efdcb374e7

from wire.

zombiezen avatar zombiezen commented on May 22, 2024

Ohhh. The issue is that Wire is not forbidding references to names introduced in function scope. Wire should throw an error in this case and not generate the code. I modified the issue description to make this more clear.

from wire.

vangent avatar vangent commented on May 22, 2024

Yea, the README explicitly says it's not supported but the error message doesn't tell you what you did wrong.

Why can't we support this?

from wire.

zombiezen avatar zombiezen commented on May 22, 2024

It is technically feasible, but it makes the rule of "wire.Value is for constants" no longer true, and thus more complex to the user.

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.