Tab completion in R2015b; bug or feature?

1 view (last 30 days)
The behavior of tab completion in R2015b has changed w.r.t. R2014b. I have a class called Example and an instance (of Example) called example. When I type exam and press tab, R2014b completes to example (and shows that Example and example exist), but R2015b completes to Example (and shows that Example and example exist). Subsequently, I have to press the down arrow key to select example. This is extremely annoying (as I have many such classes and instances, having long names). I checked the tab completion options in both of my Matlab versions and these are equal. By the way, this also works for variables having the same names but different capitalization. Try "example = 1; Example = 2; eXample = 3; EXample = 4;" and explore the differences in tab completion when typing exam or Exam in R2015b and R2014b. This might or might not occur also in R2015a. I would guess this is a bug. Or is it a feature?
  1 Comment
Guillaume
Guillaume on 22 Sep 2015
Whichever version of matlab, tab completion has never worked properly for a reason or another.
I assume this issue has come about in an attempt to fix the fact that if you only had Example defined and started to type exam matlab would complete to example, keeping the case you originally typed even though the lower case variable didn't exist.
As an aside, I'm not sure it's a good idea to have variable / class / anything only differentiated by case. Looks like a good source of bugs.

Sign in to comment.

Accepted Answer

Steven Lord
Steven Lord on 22 Sep 2015
My guess is that the change in behavior you see is related to item 3 in the Desktop section of the Release Notes for MATLAB release R2015b:
"Tab Completion: Complete commands with corrected capitalization"
Having two identifiers (example and Example) that differ only by case is likely, in my experience, to lead to confusion and a difficult to debug problem down the line.
  2 Comments
N. Otime
N. Otime on 22 Sep 2015
Thanks! I should have found this in the release notes myself. Nevertheless, I still think this new behavior is unwanted if identifiers with different capitalizations exist. In my opinion, the correct behavior should be not to convert to upper case if a lower case version exists and the user has started typing in lower case (as it is more likely that the user actually meant what she/he typed). The obvious next question is: can I switch off this new behavior?
As for having like identifiers with different capitalization: I see why this could lead to bugs that are difficult to track down, but in my experience this hasn't happened yet (we have these capitalization rules defined in our coding style).
Ken Atwell
Ken Atwell on 24 Sep 2015
Edited: Ken Atwell on 24 Sep 2015
I'm a developer in this area.
New to R2015b, tab completion will correct capitalization. For example: If you had only "Example" defined, and you type/complete "exam", MATLAB will capitalize the "E" for you. Older versions of MATLAB will not find any completion.
This works great in many situations, but I now see how this can accidently work against what N. Otime is doing, namely using case as an important "distinguisher" in the name. You've given us something to think about and consider for a future release, thanks.
Sorry, there is no way to turn off this behavior.

Sign in to comment.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!