Git Product home page Git Product logo

Comments (12)

whitequark avatar whitequark commented on August 26, 2024

Ideally, to_s would return the current representation and inspect would return yours; however, I don't know how many people rely on the return values being what they are, and it's probably not worth a major version bump.

from ast.

mbj avatar mbj commented on August 26, 2024

Data point: I do not rely on AST::Node#to_s or #inspect format in my projects.

from ast.

whitequark avatar whitequark commented on August 26, 2024

What about @bbatsov?

from ast.

rubydesign avatar rubydesign commented on August 26, 2024

my idea was that you only get it when you want it.
One could decouple it from including the Sexp and make different module if there are concerns.

from ast.

whitequark avatar whitequark commented on August 26, 2024

It is definitely a past design failure in ast.

from ast.

bbatsov avatar bbatsov commented on August 26, 2024

I'm on the road right now. Will be back home tomorrow and I'll take a look
then.

On Tuesday, September 15, 2015, whitequark [email protected] wrote:

It is definitely a past design failure in ast.


Reply to this email directly or view it on GitHub
#6 (comment).

Best Regards,
Bozhidar Batsov

http://www.batsov.com

from ast.

rubydesign avatar rubydesign commented on August 26, 2024

After having used this a bit more, i actually reverted to the multiline version. (wasn't before)
It now outputs exactly what is written in the module comment.
Even in ruby code, that can still be pasted, as the comma at the end continues the expression.
(though i personally changed to text files, less clutter)
https://github.com/dancinglightning/ast/commit/846eb00aeb6d227ffbae7a3f5c3b286f60d11667

from ast.

bbatsov avatar bbatsov commented on August 26, 2024

Ideally, to_s would return the current representation and inspect would return yours; however, I don't know how many people rely on the return values being what they are, and it's probably not worth a major version bump.

I'm not using this is as well, so I think making this change is unlikely to affect many (any) users.

from ast.

whitequark avatar whitequark commented on August 26, 2024

OK. I will accept a PR implementing this as per #6 (comment).

from ast.

rubydesign avatar rubydesign commented on August 26, 2024

ok, do you want it in the sexp module (as my code is now), or should i change the node.to_sexp to output ruby code ?

from ast.

whitequark avatar whitequark commented on August 26, 2024

No, no modules. Just inspect (outputting the code) and to_s (aliased to to_sexp).

from ast.

rubydesign avatar rubydesign commented on August 26, 2024

i guess this is clear

from ast.

Related Issues (11)

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.