You can clone with
Innocent assignment to 'c' produces: Error: Cannot find local context. Did you use binding.pry?
For example: c = 2
Note that querying the value of 'c' is also a problem, so a fix that simply looks for a following assignment operator is not good enough...
Not sure if there's an easy fix. Perhaps I should just remove the aliases?
@nixme @parker If there is demand to further disambiguate commands from ruby code we can do a couple of things:
(1) Show a warning when collisions occur
(2) Support an optional mode toggle for a command mode and a code mode (so no conflicts can occur)
Any of these appeal to either of you? any other suggestions?
Both sound like possible solutions.
Just thinking out loud, but what about two modes: the current one where commands and code are intermixed, and one where only commands work. Short aliases, like 'c', would only be enabled in command-only mode where they'd have more utility.
Dual modes, like 'vi', seems like too much of a change.
I'd be happy just to get a warning about the variable-name / command collision... The problem right now is that the error message does not lead you to an understanding of the problem.
Got it. I can improve the error messaging in the next release.
This has been reported as a bug in pry (again): pry/pry#492
We've got an experimental feature that warns the user when this happens, but a better fix is to not destroy the single-letter namespace by default (from my own experience that's the kind of variable name that I use most often while in a REPL).
I was just going to report the issue in pry too. A search brought me here.
@ConradIrwin is right IMHO. It's very common to use single letters in a REPL for variables. Probably, you should consider removing them. Or is there a way to override the alias with the variables and just show a warning message? But that can be annoying anyway... What do you think?
Remove single-letter command aliases. #3
Aliases removed in version 0.2.0 (released yesterday).
A note added to the README about adding aliases to ~/.pryrc
Thank you very much!