Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

But awful to navigate - the terse syntax combined with lack of static types and regular use of generated identifiers turns large codebases into Where's Wally. Good luck finding where the `process` function is called from. You can't even search for `process(` like you can in most languages.


You can search for "def process" - it's inheritance and metaprogramming that make finding the underlying implementation difficult.


>> Good luck finding where the `process` function is called from. You can't even search for `process(` like you can in most languages.

> You can search for "def process"

That tells you where it is defined, not where it is called from.


True. `caller` tells you where it is called from, during runtime.


Well, just add "puts caller" in the function to find out. You can do this in your own code, but also you can also just briefly patch the library you're working with, if that's where the process is.

By the way, the generated identifiers are more a rails thing than a ruby thing.


Doesn't that just tell you the functions that happen to call it when you run a program? That's not remotely as good as just getting a complete list at the click of a button.


> lack of static types

RBS is a thing; we use it extensively.

> Good luck finding where the `process` function is called from

I don't use it like that but I seem to recall RBS itself has a query mechanism and can answer these kind of questions.


> we use it extensively

Who is "we"? The Ruby projects I use are Asciidoctor and Gitlab and neither of them use it.

Also putting types in a totally separate file is an abysmal UX.


> Who is "we"?

$dayjob; does it really matter who as long as it's an example of it being useful to someone?

> putting types in a totally separate file is an abysmal UX.

Is it though? I much prefer

   def frobz(fizbazbang)
     # ... the code
to

   def frobz(Hash<Symbol | String | Integer, Array<String | Integer>> fizbazbang) -> Array<Hash<String | Integer, String>> fizbazbang
     # ... the code
It's the job of the code editor to get that information surfaced to me at the proper place (e.g virtual content like vim inlay hints, hover tooltips, those vscode embeds or whatever they are called). If I need to jump quickly I have projections† set up.

Having the types inline isn't that useful anyway as it gives yo only the signature but gives you no info of whatever type intermediate things are without much thinking.

And interesting things happen when you have separate `.rbs` files: I started to develop some things type first then progressively fill the implementation in.

† Well known because of https://github.com/tpope/vim-projectionist but projections are not limited to vim.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: