Coder Social home page Coder Social logo

Comments (5)

Tobias-Kohn avatar Tobias-Kohn commented on June 24, 2024 1

I concur: it is certainly a trade-off that could go either way and I have no strong feelings for or against either variant. Of course, Nick is using some dramatic rhetoric to make his point, quite overblowing the importance of this.

Without doubt, it would be a cleaner design with dedicated nodes, but at the expense of a significant population growth in the realm of AST nodes. While I like a clean design as much as the next man, I am not too sure about having to deal with a bunch of additional nodes—although it would probably be 'honest'. As you say, reusing the 'context' field does not seem like a good idea and would IMHO lead to a more brittle and complex design.

At the end of the day, it might be a good idea to have dedicated nodes because of the resulting cleaner design that provides a better abstraction from the concrete syntax used. If you squint a little, you might even put that into the category of "explicit is better than implicit" in that the nodes along with their handlers receive more descriptive names 😉.

from patma.

gvanrossum avatar gvanrossum commented on June 24, 2024

(What about the next woman? :-)

from patma.

brandtbucher avatar brandtbucher commented on June 24, 2024

Can we agree to defer this, then? It can easily be changed in a later alpha (I'm even comfortable with changing it in an early beta if Pablo is). If somebody makes noise about an actual use case where these new nodes are a quality-of-life improvement (mypy?), then that's probably enough to convince me. The only client I've converted so far is ast.unparse, which is much simpler with the current design.

I'm really not enthusiastic about creating, documenting, supporting, and testing a dozen new stdlib classes when our collective opinion is just "meh".

from patma.

Tobias-Kohn avatar Tobias-Kohn commented on June 24, 2024

Yes, I am absolutely on board with the idea of deferring it. It seems to be mostly an implementation detail that is important rather for "meta-tools". Frankly, I share your feeling of not being too excited about creating all these new classes if there is not a real need for it.

from patma.

gvanrossum avatar gvanrossum commented on June 24, 2024

Sounds good to me. I think mypy will survive; it has its own AST structure that is derived from ast.AST by a transformation, and if it is necessary to use different nodes to represent e.g. a class pattern than a function call (which is likely) that can be done quite cleanly in the transformation.

from patma.

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.