Issue #4877 has been updated by John Higgins.


It always happens - you give someone enough rope and they always end up with it wrapped around their neck.....

Lazaridis Ilias wrote:
> The one thing which should be clear is, that "Unify Variable Expansion within Strings" is something which would make the language better. Rejecting this is like saying: "Everything is fine with variable expansion".
> 
> But it's not. 
> 
> * It starts with the usage of "#", which is the comment char. 

So why then are you suggesting to use # as the start of your grand unified system?

> * Then there is the inconsistency of it's usage. 
> * The only consistent way is the 3-char-way "#{}" (sometimes more overhead than the var name).

How can it be inconsistent and consistent at the same time?

> * and *most* important: currently, there is *no* way to alter this behaviour, as it is in c-core-level.

If that's the most important thing in the world - why not request that option? You have not done that at all here - you have rambled on about something that has no bearing on whether or not it can be changed. In fact you have simply advocated for another way of doing #{} - no where until that very line had you even mentioned the concept of having it changeable on the fly. Running out of steam and grasping for anything you can?

> 
> All this should be enough to leave this issue open, thus possibly a solution comes up. Even if you place it on "1.9.x" or even the 2.0 line (where I assume some incompatibility is tolerated more).

There is nothing there at all to leave this issue open.

> 
> I think that's the Status:"Feedback" (although this can take quite a while). But who knows, possibly someone comes up with a full compatible solution.
> 
> It's like saying: "Yes, we have an issue here, something has to be done".

Except we do not have an issue here.
----------------------------------------
Feature #4877: Unify Variable Expansion within Strings
http://redmine.ruby-lang.org/issues/4877

Author: Lazaridis Ilias
Status: Rejected
Priority: Normal
Assignee: Yukihiro Matsumoto
Category: core
Target version: 


class VarTester
  $g = "global" 
  @@c = "class"
  
  def f
    "function"
  end

  def initialize
    @i = "instance"
    l = "local"
    puts "#$g #@@c #@i #l #f #{l} #{f}"
  end
end

VarTester.new 

#=> global class instance #l #f local function

=== User Context ===

3 variable types (Class- instance- and global) can be expanded by prefixing a single char ("#") (without the need to add "{}").

This should be enabled for local vars and ideally for functions, too (at least the attr accessors).

=== Pro ===

* consistent expansion of all variable types via "#"
* reduced typing (use of {} is optional)
* increased readability of strings which contain many variables.

=== Contra ===

?

=== Compatibility ===

This would break slightly existent behaviour:

 existent '#text' within strings would be expanded (should be a rare case)






-- 
http://redmine.ruby-lang.org