Git Product home page Git Product logo

Comments (3)

bew avatar bew commented on June 2, 2024 2

@greyblake please re-open, it's possible with macros!
Something like ls String could do a pp {{ String.methods.map(&.name.stringify) }} to list all methods name.

It's a very basic example, but you can get other information on each method (it's signature, body, etc..) with some more macro code :)

from icr.

greyblake avatar greyblake commented on June 2, 2024

Hey.
Thanks for the suggestion.
At the moment it won't be possible to have, because Crystal does not have such reflection mechanisms like Ruby has, e.g. methods, like Object#methods, Object#instance_variables, etc.

I'll close the issue for now.
Please reopen it, if you have an idea how this could be achieved.

from icr.

bew avatar bew commented on June 2, 2024

Doing some ruby now, and actually used ls on an ActiveRecord object, it's pretty cool in pry!!!

About ls for icr, would be nice to have:

  • ls String: to show all methods defined in String (but not in Comparable / Object)
  • ls -a String (or similar, with a crystal syntax): to show all available methods in String, including methods from included modules, base classes, etc.. (Comparable / Object / Reference...)

With full methods signature, and maybe a mention when the method is generated from a macro (not possible yet from macros, but maybe we can find a workaround)

from icr.

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.