Skip to content
This repository

Assignment to 'c' is confused with abbreviated 'continue' command #3

Closed
rparker opened this Issue January 16, 2012 · 10 comments

5 participants

Randy J Parker Gopal Patel John Mair Conrad Irwin lucapette
Randy J Parker

Innocent assignment to 'c' produces: Error: Cannot find local context. Did you use binding.pry?

For example: c = 2

Randy J Parker

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

Gopal Patel
Owner

Not sure if there's an easy fix. Perhaps I should just remove the aliases?

John Mair
Collaborator

@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?

Gopal Patel
Owner

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.

Randy J Parker

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.

Gopal Patel
Owner

Got it. I can improve the error messaging in the next release.

Conrad Irwin

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).

lucapette

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?

Gopal Patel
Owner
nixme commented March 20, 2012

Aliases removed in version 0.2.0 (released yesterday).

A note added to the README about adding aliases to ~/.pryrc

Gopal Patel nixme closed this March 20, 2012
lucapette

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.