Live data from Hacker News

“Did you mean?” Experience in Ruby

yukinishijima.net

161–170 of 187 posts

Re: “Did you mean?” Experience in Ruby

#161

Seems like a bandaid approach to fixing a severed artery. The real problem is the lack of desire to read documentation. This also has the problem of sending someone down the wrong path when the wrong "solution" is suggested. Read more documentation and pay attention while you're programming.

I don't think this has to do with a lack of knowledge of documentation, it has to do with simple spelling errors. Quite a number of times I type a method name wrong and upon scanning the code don't see the missing, duplicated, or mistyped letter. This would help a lot with that.

Re: “Did you mean?” Experience in Ruby

#162
post #119
post #38

Earlier quoted context omitted.

> Aren't Java and C++ statically-typed as well? Yeah, but not so you'd notice, coming from an ML or Haskell background. /sarcasm More seriously, Java and C++ (and C and Algol before them) fell into the trap of defining "data size specifications" as types: The discontinuity between "long long int" and "int" is one, as is the discontinuity between "float" and "double". The real type difference is between things which a…

It is not a "trap". In "C" it is required to generate fast machine code. It's a trade-off, not a "trap".

C (note lack of quotes) and Haskell regularly trade off "Fastest language in the world" spots on shootouts. Maybe "C" (with quotes), which is obviously a different language, is faster; I doubt it.

Re: “Did you mean?” Experience in Ruby

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

Just for you! https://github.com/Shervanator/feeling_lucky

Haha, loving the description :)

Re: “Did you mean?” Experience in Ruby

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

Why though? Why not do it at the language level?

When you're returning an error, you can be a bit slow. So why not do some extra computation and return a better error message?

Re: “Did you mean?” Experience in Ruby

#166
post #71

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…

I have exactly this frustration as a person coming from static languages (mostly C++) to web dev. Anybody can recommend something more comfortable? I like the concept of Vaadin, but I'd prefer something non-Java.

ASP.NET maybe? C# is one of the best-designed languages suitable to server-side dev in modern popular use. Using it with VS is the most convenient and efficient IDE experience I've encountered.

Re: “Did you mean?” Experience in Ruby

#167

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…

This is honestly an issue I don't experience, if I have a typo my test fails and the compiler tells me the line and method call that failed. I correct it, carry on. I can't think of a scenario where you would get stuck with this type of problem.

Re: “Did you mean?” Experience in Ruby

#168

I hope somebody forks this and creates a version that automatically corrects the method for you at runtime. Why even show an error or throw an exception? Bonus if the corrections are cached for performance.

Hopefully you're joking.

As if it wasn't already hard enough to figure out the code path in a ruby application, now we can make it largely indeterminate and dependent on an ever-changing fuzzy algorithm!

Re: “Did you mean?” Experience in Ruby

#169
post #77
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…

And with Ruby, especially since you mention Smalltalk, we have a tool that is getting closer to the kind of live introspection and modification that Smalltalk is famous for: Pry [1]. Pry lets you call "binding.pry" anywhere in your program to dump you into a shell within that context, with full access to local variables etc.. And tab-completion and plenty of introspection features. I frequently find myself triggering…

https://github.com/pry/pry/issues/840#issuecomment-60286408 is causing me angst. Any idea?

Re: “Did you mean?” Experience in Ruby

#170
post #167

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…

This is honestly an issue I don't experience, if I have a typo my test fails and the compiler tells me the line and method call that failed. I correct it, carry on. I can't think of a scenario where you would get stuck with this type of problem.

Compare this with an IDE highlighting this immediately when you write the offending line. In your workflow you have to run a test to identify this issue, then go back and fix it. It certainly doesn't leave you stuck but you are incurring additional overhead in that you actually have to run tests to discover there's a problem and then remediate it.
Post reply on HN