Live data from Hacker News

“Did you mean?” Experience in Ruby

yukinishijima.net

41–50 of 187 posts

Re: “Did you mean?” Experience in Ruby

#41
post #35

Earlier quoted context omitted.

Context sensitive auto-complete is a godsend.

Seriously. Is there a good list of tools that provide it? In Python, the only one I've managed to love is PyDev. Supposedly Atom does it with the "script" package?

PyScripter supports it, but it's Windows only and seems abandoned by the devs.

Re: “Did you mean?” Experience in Ruby

#42
post #24
post #3

This sort of stuff should, at least in the 'easy' case be done at the editor level. Doesn't ruby have linter tooling for this? Still, props for the work.

Ruby has a linters, but this sort of problem is hard to solve with a linter in a dynamically typed language. It's even harder in a Rails environment since Rails adds many methods to your classes at run time.

Such things are usually solved by parsing the structured javadoc-like API documentation for classes and methods in addition to the code itself. At least that's how it's done in the PHP world and it works quite well. Obviously it's not going to cover 100% of the cases, but much better than nothing.

Plus it incentivizes you to write this documentation in the first place, which you can then instantly bring up inside the IDE from any place where the method is used.

Re: “Did you mean?” Experience in Ruby

#43
post #32

I've been pairing with ruby / rails developers since 2010 and coming from statically typed languages, it's unbelievable how much time gets spent playing "guess the method name". Even in rich IDEs like RubyMine, the utter lack of context in any given file in rails leaves programmers typing their best guess of a method name, running the tests, rinse, repeat. This solution, while creative and laudable, solves a problem…

It's kind of silly, the major benefit of using Ruby (or JavaScript nowadays) is to iterate quickly. But then, some of their users spend months turning a text editor into an IDE just to waste precious hours on spelling errors.

Most text editors have naive autocomplete (using a words list and words they see), which catches 99% of these errors.

Re: “Did you mean?” Experience in Ruby

#44
post #35

Earlier quoted context omitted.

Seriously. Is there a good list of tools that provide it? In Python, the only one I've managed to love is PyDev. Supposedly Atom does it with the "script" package?

I've been working with PyCharm [1] a lot lately and I've come to like it a lot. Probably the best context awareness I've seen for any dynamic language - it (almost) feels like working in something more tool-friendly like Java in that regard. [1]: https://www.jetbrains.com/pycharm/

PyCharm's auto-complete is really nice. It seems to be the best Python editor going right now.

Re: “Did you mean?” Experience in Ruby

#45
post #8

I would love it if instead of quitting my program with an error, it just went ahead and called the method it thinks I'm referring to. This would remove a lot of unneeded friction from web development.

You should implement a `yolo` gem to support this.

Re: “Did you mean?” Experience in Ruby

#46
post #40

A lot of people are recommending IDE-like tooling--but in truly dynamic language (one with a "living image" with path-dependent monkey-patched behavior that can't be replicated during static analysis, like Smalltalk--or, sometimes, Ruby) there's a more idiomatic way. In a dynamic language, if you're at all unsure of what code you need to write, then you don't write it in your editor in the first place. Instead, you b…

"something that manages your expression experiments and the context harnesses they need"

This is the exact purpose of tests.

Re: “Did you mean?” Experience in Ruby

#47
post #43
post #32

Earlier quoted context omitted.

It's kind of silly, the major benefit of using Ruby (or JavaScript nowadays) is to iterate quickly. But then, some of their users spend months turning a text editor into an IDE just to waste precious hours on spelling errors.

Most text editors have naive autocomplete (using a words list and words they see), which catches 99% of these errors.

For example I use pabbrev mode in emacs, which learns what I type. It hints me away from most misspellings because it suggests the correct alternatives before I type them. Most of the long method and variable names for me are a prefix plus a TAB.

Nevertheless I'll try this gem.

Re: “Did you mean?” Experience in Ruby

#49
post #8

I would love it if instead of quitting my program with an error, it just went ahead and called the method it thinks I'm referring to. This would remove a lot of unneeded friction from web development.

You should implement a `yolo` gem to support this.

Welp, next april fools day gem idea reserved!

Re: “Did you mean?” Experience in Ruby

#50

The value of static typing is more and more apparent. Recently I've played with ocaml and F# and it felt great compared to Java or C++.

... until you start trying to make your app testable. (I say this as a developer of primarily statically typed languages.)

Try using a good type-inferred statically-typed language. Hint: this rules out Java, C# etc.
Post reply on HN