Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable function listing with tab #86

Open
lowks opened this issue Jan 10, 2018 · 2 comments
Open

Enable function listing with tab #86

lowks opened this issue Jan 10, 2018 · 2 comments

Comments

@lowks
Copy link

lowks commented Jan 10, 2018

It would be great if icr can list down all the functionality of a type say an integer in icr. The example below is taken from IPython
screen shot 2018-01-10 at 11 09 53 am

@veelenga
Copy link
Member

@lowks well, probably. Personally, I'm against this unless icr becomes a fully functional REPL see #79. Currently icr mostly used to quickly try few language features the user not confident with, so it takes only few minutes to interact with this app and probably most users will not need function listing. But, I may be wrong.

Crystal is compiled, which again brings some limitations and complexity in the implementation of this. But I found it still possible to do:

class Object
  def methods
    {{ @type.methods.map &.name.stringify }}
  end
end

10.methods.grep /^to_i/ # => ["to_i", "to_i8", "to_i16", "to_i32", "to_i64", "to_i128"]

If you are willing to try to implement it, please send a pull request, even on early stages. I will be happy to review.

@KINGSABRI
Copy link

I think these #79 #97 are supporting the idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants