As we know, in ruby, we have many introspection methods in runtime, e.g. Object#instance_methods, Module.class_methods etc …
As a static language, there may not those methods exists in runtime, but, i consider, print all instance methods/class methods which defined on one class on compile time, is possible, right?
Following is a example:
require "bip39"
require "secp256k1"
m0 = Bip0039::Mnemonic.new 256
priv = Secp256k1::Num.new m0.to_hex
key = Secp256k1::Key.new priv
p! typeof(key) # => Secp256k1::Key
Because LSP support for crystal is poor, there is no easy way to jump to definition when i cursor on the key variable, and pressing some keybinding or click on mouse, i have to open source code to find it out.
so, i consider if there have a more easy way to do this? e.g. consider above example,
I really want to know if there is a easy way to print out where Secp256k1::Key
is defined, or even more, print all instance methods defined on Secp256k1::Key
directly?
e.g.
how to know a method named private_hex
is defined in this key object quickly?
key.private_hex # => "08647a626a6c96bfa9f5847a7d53f78b4cd23234a4b8fa22c489e838af4cb94e"