Yes, you're right about being able to just define a new method instead of overriding an operator, but even simple addition (+) is a method itself, right? Overriding itself (multiple methods with different signatures) is just a nice-to-have feature that is not necessary.
- Matt Small -----Original Message----- From: S.Isaac Dealey [mailto:[EMAIL PROTECTED] Sent: Monday, April 25, 2005 9:34 AM To: CF-Community Subject: RE: I'm in love with Ruby Thanks Matt, You're right, I misread it... This makes a lot more sense... Though I'm not sure I see a real advantage to it... I mean... Fullnames = FirstNames + LastNames might just as easily be written Fullnames = ArrayMerge(Firstnames,Lastnames) or Fullnames.setNames(Firstnames,Lastnames) It's certainly interesting tho. > You may be missing the point with operator overriding. It > exists to allow > new classes to use the operators in a manner that is > familiar but not > intrinsically understood by a computer. > Say for instance you've written a class that is simply a > list of names > contained in an array. You could have three instances of > this class - > Firstnames, Lastnames, and Fullnames. Consider this > operation: > Fullnames = Firstnames + Lastnames; > In most languages, this would not make any sense. It's > not even easily > understood by a human as to the function of this list. > But you can define > the operation of the + sign to be any number of things: > 1) Firstnames: Issac, Matthew > Lastnames: Dealey, Small > Fullnames: Issac Dealy, Matthew Small > 2) Firstnames: Issac, Matthew > Lastnames: Dealey, Small > Fullnames: Issac, Matthew, Dealey, Small > 3) Firstnames: Issac, Matthew > Lastnames: Dealey, Small > Fullnames: IDsesaalcey, MSamtatlhlew > 2) Firstnames: Issac, Matthew > Lastnames: Dealey, Small > Fullnames: Issac, Dealy, Matthew, Small > Keep in mind that this operator overriding will only be > effective for this > particular class. C= A + B where A, B, C are integers > will still be normal > addition. > - Matt Small s. isaac dealey 954.522.6080 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://macromedia.breezecentral.com/p49777853/ http://www.sys-con.com/author/?id=4806 http://www.fusiontap.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Purchase Studio MX with Flash Pro from House of Fusion, a Macromedia Authorized Affiliate and support the CF community. http://www.houseoffusion.com/banners/view.cfm?bannerid=51 Message: http://www.houseoffusion.com/lists.cfm/link=i:5:155200 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
