Issue #8365 has been updated by matz (Yukihiro Matsumoto).


Interesting, but this would make Ruby VERY SLOW.
I am not sure whether it's worth the performance degration.

Matz.

----------------------------------------
Feature #8365: Make variables objects
https://bugs.ruby-lang.org/issues/8365#change-39142

Author: boris_stitnicky (Boris Stitnicky)
Status: Feedback
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: 
Target version: Next Major


While refactoring a wiki article about Ruby, I found this anonymous proposal:

"How about making variables objects. And assignment is the default message you send to the variable object (not the underlying reference). anintvar 5, now the variable "anintvar" is a reference to the constant integer 5. And since variables are objects, you can do some neat things like subclass variables. It would be a mixed world of static variable typing and dynamic. Use the appropriate one for a given scenario. You could also do linear casting. exm. 
                        integer new anintvar 5
                        char new acharvar anintvar

Variable types and the reference object they point to can be 2 different types. But the variable decides how to do the casting not the object referenced. "anintvar" and "acharvar" reference the same object."

I am pasting this anonymous proposal here in original full length, before I rewrite it to a more concise form in that wiki page.


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