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
-----Original Message-----
From: S.Isaac Dealey [mailto:[EMAIL PROTECTED]
Sent: Saturday, April 23, 2005 10:29 AM
To: CF-Community
Subject: Re: I'm in love with Ruby
I'm not trying to trash Ruby... just wanted to make the comment
that... given the description of the previous message, in which all
the language's fundamental operators (+/ modulus, array notation, etc)
are methods which anyone can overwrite, I would imagine that would
mean great for hackers, but you'd have to be clinically insane to
provide technical support for anything written in Ruby, given that you
would never be able to say with any certainty that for instance array
notation works in a specific manner (or for that matter that it even
_should_ work in a specific manner).
The mutators point is interesting, although personally I think I
prefer for mutator to be the default -- this is an unfortunate area
where I dislike CF's implementation, although it's too late to do
anything about it now, that CF functions are mutators by default until
the argument is an array. I prefer mutators by default because it's
real easy to just duplicate(argument) inside the function to change
its behavior, and don't really see a large advantage in having a
notational cue in the method name to indicate if the function is or
isn't a mutator.
> 1. Yes, I'm using it on win32 currently. I believe it
> runs on several
> different platforms.
> 2. There are windowing toolkits available. I've not
> ventured into
> them yet. I'm more interested in the web application
> server side of
> things.
> On 4/22/05, C. Hatton Humphrey <[EMAIL PROTECTED]>
> wrote:
>> Sounds interesting and I've heard a bit about it before -
>> my two questions are:
>>
>> 1. I know that Ruby is big on *nix, does it exist in any
>> format on
>> Windows? and if so
>> 2. Can it interact in a desktop environment or is it used
>> solely for
>> behind the scenes stuff?
>>
>> Hatton
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://www.fusiontap.com
http://www.sys-con.com/author/?id=4806
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:5:155191
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=11502.10531.5
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54