Live data from Hacker News

“Did you mean?” Experience in Ruby

yukinishijima.net

61–70 of 187 posts

Re: “Did you mean?” Experience in Ruby

#61

Earlier quoted context omitted.

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.

Really? I used Aptana, which includes the Pydev plugin. I notice everyone seems to give PyCharm lots of love, and have been tempted to try it. Autocomplete is one of the features I rely on heavily.

Re: “Did you mean?” Experience in Ruby

#63
> Sometimes I wasted hours and hours just becaue there is one charactor difference. I hate it.

Haha, humans are much more able to parse meaning, despite a character being off here or there. Well, you've taken computers one step closer to humans. And you've made programming with Ruby friendlier. Great job!

Re: “Did you mean?” Experience in Ruby

#64

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…

When I code in Python I always have ipython console handy to try snippets of code and to autocomplete methods and fields.

Re: “Did you mean?” Experience in Ruby

#65
post #58
post #53

Earlier quoted context omitted.

Funny that you mention Smalltalk, because of its image model, completion usually works quite well. I remember using it on my Smalltalk days at the university in 1996.

It works great if either A. The IDE lives inside the same live image the project being developed is loaded in; or B. there exists some sort of network/RPC-exposed "code server" running within the live image, which you can ask to do these sorts of completions. Of non-Smalltalk languages, the only one I can think of with anything like that is Erlang. You could easily enough build a code server in Ruby, but you'd have t…

Yes you are quite right.

The image must always exist, either a real one like Smalltalk, or a virtual one like in your examples.

I think it is more of an issue for those that have decided to live outside an IDE though, as they usually have good support for such live sessions.

For example, Netbeans support for JavaScript and JRuby is quite good.

Re: “Did you mean?” Experience in Ruby

#66
post #59
post #43

Earlier quoted context omitted.

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

I have experienced some problems with this kind of autocomplete in a JS project. -Two methods shouldn't have a similar name, so you try to avoid it, possibly leaving you with a worse abstraction. -You usually need to have all files open or at the same location, so modularization is discouraged. -Libraries are usually not picked up by it. -If you make a spelling error on the first usage you now have this spelling erro…

YMMV, but I don't experience any of those problems. Also, I don't see where same names pose any problems.

Most advanced language plugins pick up libraries.

Re: “Did you mean?” Experience in Ruby

#67
post #64

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…

When I code in Python I always have ipython console handy to try snippets of code and to autocomplete methods and fields.

Second that. That's why ipython is extremely handy. Also function/block wise history.

Re: “Did you mean?” Experience in Ruby

#68
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.

That has been tried before. Results were... poor.

http://www.catb.org/~esr/jargon/html/D/DWIM.html

Re: “Did you mean?” Experience in Ruby

#69
post #2

Neat. In case you're wondering, it's implemented using a levenshtein distance algorithm: https://www.omniref.com/ruby/gems/did_you_mean/0.6.0/symbols... and it works by extending the NameError exception: https://www.omniref.com/ruby/gems/did_you_mean/0.6.0/files/l...

The close_enough gem takes this one step further and uses this to 'patch' method_missing:

http://decomplecting.org/blog/2013/03/01/code-typos-got-you-...

Post reply on HN