This doesn’t answer all of your points but in terms of finding out where something is defined you can turn a method into a Proc and then ask it. Eg
some_instance.method(:foo).source_location
There’s a similar method for source definition. Both are useful dealing with over use of meta-programming.Elixir is much more explicit compared to Ruby in terms of "where is X?" and its compiler apparatus (and user-available hooks and tooling) is getting expanded in 1.11 which is landing soon -- but to be 100% objective, some libraries utilize macros where alias/import/require might be used, which obscures things sometimes.
The tooling still catches all dependencies and their sources though (via `mix xref ...`)
Re:Show HN: Compile Ruby to C
by joelbluminator on Monday September 21, 2020 @06:44AM
(#24541844)
> However, recently I started a project with Ruby, thanks to language servers
What do u mean exactly?
Re:Show HN: Compile Ruby to C
by samtheprogram on Monday September 21, 2020 @07:58AM
(#24542275)
Language servers provide generic autocomplete and other language-specific functionality (e.g. rename a method, find all references to a symbol within your project, find where a symbol is defined, etc) to any editor that supports them. The reference implementation is VSCode, so if you use VSCode you can definitely use language servers, but now that’s it’s picking up steam, support is getting added to other editors, e.g. see vim-coc.
The Ruby language server in question: https://solargraph.org/
Re:Show HN: Compile Ruby to C
by joelbluminator on Monday September 21, 2020 @09:07AM
(#24542855)
Interesting. Do u know what Rubymine is using ? it's own in-house solution?
Come on, use Rubymine or any other smart editor to find definitions..
Re:Show HN: Compile Ruby to C
by t-writescode on Monday September 21, 2020 @02:26AM
(#24540437)
I've been using Ruby in IntelliJ for nearly a year now at my new job. Up until literally the very most recent version of it, this has definitely not been enough to be able find some methods.
Like, ... 'move' or 'read', or some other horribly overloaded function that is the one that I need to go and find the specific implementation of because it's busted.
You need more than just Rubymine in many cases.
And no, sometimes it's quite difficult to get the exact configuration required to get that code path to figure out what's wrong.
Re:Show HN: Compile Ruby to C
by samtheprogram on Monday September 21, 2020 @07:54AM
(#24542239)
I was fairly unhappy with RubyMine 4-5 years ago, when I last worked in Ruby long-term. Glad to hear it’s gotten better. I’ll have to revisit it, especially if there’s a CE for RubyMine.
To GP: there weren’t at the time any other options for a Ruby “smart-editor” AFAIK. However, like I mentioned in my comment, I’m giving Solargraph [1], a Ruby language server, a try, which is equivalent.
Re:Show HN: Compile Ruby to C
by calineczka on Monday September 21, 2020 @02:56AM
(#24540575)
Rubymine is fantastic most of the time. But when projects use too much DSLs and 'magic', nothing helps.
However, recently I started a project with Ruby, thanks to language servers. I’m hoping this solves that issue, but it’s too soon to say.
There’s still other issues with the require mechanism, and Ruby in general, and other languages to try, e.g. Elixir and Crystal. I haven’t been sold yet in terms of what Ruby excels at, and those languages are each different in their own right.