On 9/24/07, Chris Shea <cmshea / gmail.com> wrote:
> I'm pleased to announce version 0.1 of my little aggressive spelling
> corrector for irb.
>
> sudo gem install guessmethod
>
> And live the life!
>

Interesting idea, some potential improvements.

A simple way to improve guessmethods behavior for libraries that rely
on overriding method_missing would be to start your method_missing
replacement with a check to see if self.respond_to?(method) and then
dispatch the old method_missing.

This will only prevent killing code that was previously working, and
not enable any improvements in method guessing. To correctly handle
method-guessing I would suggest to introduce some api for guessmethod
which one could interact with. So that rails-models could define a
method like guess_similar_methods(method) or something like that.

If you mainly use this for your irb-sessions, another suggestion might
be to have an interactive mode, when you are not able to find a good
method. So that you get a scenario similar to:

001:0> Model.new.tedt = "test"
The instance of Model doesn't respond to 'tedt='.
If you misspelled the name, type the correct name, otherwise leave blank:
test=
=> "test"
002:0>

It's not a massive improvement but at least it saves you from some
editing, and would also come in handy when the involved computations
are long-running.

!g