From: Mark Van Holstyn Date: 2006-05-06T15:11:15+09:00 Subject: Re: Overloading math operations ------=_Part_23658_8265409.1146895870157 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Use this alias line... alias :old_plus :+ both of the arguments to alias need to be symbols. also, "old+" wont be a happy method name. Mark On 5/6/06, Frank Hirsch <0ffh@frankhirsch.net> wrote: > > > Hija, > > been makin a little "Vector" class by extending Array. > Now I wanna add Vector support to the native numeric > data types in ruby. Means: Not only Vector+Numeric > but also Numeric+Vector should call my + function. > > But I have a syntax prolem.. :-( > > Example (not working!): > > class Fixnum > alias old+ + # here i have the syntax problem > def +(other) > if (other.class<=3DVector) > other+self > else > self.old+(other) > end > end > end > > Someone please help poor ruby nooby! :-))) > > Regards, 0ffh > > > > -- > Posted via http://www.ruby-forum.com/. > > -- Mark Van Holstyn mvette13@gmail.com http://lotswholetime.com ------=_Part_23658_8265409.1146895870157--