|
From: | Dmitry Gutov |
Subject: | bug#16610: 24.3.50; [ruby-mode] Variables named as built-in functions font-locked incorrectly |
Date: | Sat, 01 Feb 2014 18:29:10 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
On 01.02.2014 17:31, Bozhidar Batsov wrote:
Variables can’t end with ?, so block_given? is always clear. Same goes for exit!. Pretty sure no one will ever name a var __xxx__.
Good points.
`binding` & `caller` seem the most likely names in the list to cause a problem like `format`, since they’d be good variable names (at least in code making use of metaprogramming).
Still not very likely, though (e.g. compared to `format`, which is in every other Rails tutorial). And anyone doing metaprogramming should be aware of these two, and would probably name their vars differently.
I have a patch ready, but here's what I'm not sure about: if the built-in method that requires arguments is followed by (maybe whitespace and) newline, do we highlight it?
If yes, we'll have false positives when a local variable with that name is at a line by itself, maybe on the last line of a method, so that its value is returned.
If no, any such built-in won't be highlighted until the user types in the first argument, which is also suboptimal (if I made a typo, I'll have to go back a longer distance).
[Prev in Thread] | Current Thread | [Next in Thread] |