From: "nobu (Nobuyoshi Nakada)" Date: 2013-10-30T22:49:04+09:00 Subject: [ruby-core:58077] [ruby-trunk - Feature #9060] "Assignment" operator overloading Issue #9060 has been updated by nobu (Nobuyoshi Nakada). Description updated ---------------------------------------- Feature #9060: "Assignment" operator overloading https://bugs.ruby-lang.org/issues/9060#change-42658 Author: popoxee (Bruce Metz) Status: Rejected Priority: Normal Assignee: Category: Target version: =begin I understand assignment in ruby is assigning an object to the variable. However there are other cases we need to use assignments. For example: class Foo end class Bar < Foo end f = Foo.new b = Bar.new //Some operations on b Now we want ((|f|)) to contain the same data as ((|b|)). But if we use (({f = b})), ((|f|)) will not be (({Foo})) any more. Or we can define a method like (({Foo##loadFromBar})), but (({Foo})) is the super class of (({Bar})) and usually defined before (({Bar}))... Can we have something like: f := b so that ((|f|)) will have the same shared data with ((|b|))? And we can even load data from other classes by overloading this operator: class Foo def :=(f) @data = f end end f = Foo.new f := 2.2 We can always achieve this by defining a named method, but this operator can provide some syntax sugar and convenience. =end -- http://bugs.ruby-lang.org/