Issue #4877 has been updated by Lazaridis Ilias.


Yukihiro Matsumoto wrote:
> Hi,
>  
>  In message "Re: [ruby-core:37079] [Ruby 1.9 - Feature #4877] Unify Variable Expansion within Strings"
>      on Mon, 13 Jun 2011 19:07:44 +0900, Lazaridis Ilias <ilias / lazaridis.com> writes:
>  |
>  |I understand this, but:
>  | * a typical user does not use "Class#method" often. 
>  | * Even if, he could simply uses "Class\#method".
>  |
>  |Subjecting the issue-processing:
>  |
>  |why are you so eager to "reject" immediately? I understand that "Rejected" means that the issue topic is closed, and it will not dealt with. 
>  
>  Firstly, for most of the cases, you are not the first one to come up
>  with the idea like this.  

I assumed this, and it's just a reason more to give this issue more attention.

>  I have already considered the idea long before you proposed.

Is this documented somewhere (thus one can see the rationales)?
  
>  Secondly, most quick-rejected proposals introduce incompatibility,
>  with which the feature would less likely be accepted.

I understand this, but the proposal was not a final one. It was an initial one.

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. 
* 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).
* and *most* important: currently, there is *no* way to alter this behaviour, as it is in c-core-level.

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

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


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