April 22, 2005 Re: opCmp - any consensus | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | Stewart Gordon wrote:
> Walter wrote:
>>
>> I was thinking about changing Object.opCmp to return false if the argument is null. I think that would satisfy most peoples'
>> objections to it.
>
> So every object would rank equally with null? I'm not sure what
> sense that would make....
Me neither. For opEquals, sure. But for opCmp ? Hmm...
The approach I took in a simple "String" class I made was:
int opEquals(Object o)
{
if (this is o)
return true;
String string = cast(String) o;
if (string is null)
return false;
return this.str == string.str;
}
int opCmp(Object o)
{
if (this is o)
return 0;
String string = cast(String) o;
if (string is null)
assert(0);
return std.string.cmp(this.str, string.str);
}
Based on how the same thing was being done in Java.
("cast" also takes care of the other's "instanceof")
--anders
|
April 22, 2005 Re: opCmp - any consensus | ||||
---|---|---|---|---|
| ||||
Posted in reply to TechnoZeus | In article <d4ad7d$21ev$1@digitaldaemon.com>, TechnoZeus says... > >And what of those cases where it is known but still not implemented? Better to have a default. If someone wants to make something not comparable, then they can override the default accordingly, I would think... just as Walter is talking about doing in the case of the argument being null. > >This makes much more sense than to remove useful functionality from the language. total BS Do u program? |
April 24, 2005 Re: opCmp - any consensus | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | "Stewart Gordon" <smjg_1998@yahoo.com> wrote in message news:d4ah96$24ha$2@digitaldaemon.com... > TechnoZeus wrote: > > And what of those cases where it is known but still not implemented? > <snip top of upside-down reply> > > What is "it" here? And known to whom? > > Stewart. > > -- > My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit. Sorry. I thought the meaning would have been clear inthe context of what it was a reply to. Obviously, I was mistaken, so here's a translation... <translation> And what of those cases where the fact that the object is comparable is known (by the programmer of that object) but still not implemented? </translation> TZ And what of those cases where it is known but still not implemented? |
April 24, 2005 Re: opCmp - any consensus | ||||
---|---|---|---|---|
| ||||
Posted in reply to StarCrossed | "StarCrossed" <StarCrossed_member@pathlink.com> wrote in message news:d4ajh6$26kn$1@digitaldaemon.com... > In article <d4ad7d$21ev$1@digitaldaemon.com>, TechnoZeus says... > > > >And what of those cases where it is known but still not implemented? Better to have a default. If someone wants to make something not comparable, then they can override the default accordingly, I would think... just as Walter is talking about doing in the case of the argument being null. > > > >This makes much more sense than to remove useful functionality from the language. > > total BS > > Do u program? > > That doesn't even deserve an answer, but.. yes. TZ |
April 24, 2005 Re: opCmp - any consensus | ||||
---|---|---|---|---|
| ||||
Posted in reply to TechnoZeus | On Sat, 23 Apr 2005 21:39:07 -0500, TechnoZeus wrote: [snip] > Sorry. I thought the meaning would have been clear inthe context of what it was a reply to. Obviously, I was mistaken, so here's a translation... I too have a real problem with your replies. I have to work hard to discover what it is you are actually replying to. The problem seems to stem from your top-posting style. It just makes it too much work to bother reading your posts. You leave in the posts all the other stuff you are *not* replying to. It is quite confusing. -- Derek Parnell Melbourne, Australia 24/04/2005 8:57:37 PM |
April 24, 2005 Re: opCmp - any consensus | ||||
---|---|---|---|---|
| ||||
Posted in reply to TechnoZeus | On Sat, 23 Apr 2005 21:40:17 -0500, TechnoZeus wrote: > "StarCrossed" <StarCrossed_member@pathlink.com> wrote in message news:d4ajh6$26kn$1@digitaldaemon.com... >> In article <d4ad7d$21ev$1@digitaldaemon.com>, TechnoZeus says... >>> >>>And what of those cases where it is known but still not implemented? Better to have a default. If someone wants to make something not comparable, then they can override the default accordingly, I would think... just as Walter is talking about doing in the case of the argument being null. >>> >>>This makes much more sense than to remove useful functionality from the language. >> >> total BS >> >> Do u program? >> >> > > That doesn't even deserve an answer, but.. yes. Well it just wasn't all that obvious. Thanks for clearing it up. -- Derek Parnell Melbourne, Australia 24/04/2005 9:00:39 PM |
April 24, 2005 Re: opCmp - any consensus | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | "Derek Parnell" <derek@psych.ward> wrote in message news:l9bbk7o31w4s$.13wkgjjxknpmt.dlg@40tude.net... > On Sat, 23 Apr 2005 21:39:07 -0500, TechnoZeus wrote: *snip* > I too have a real problem with your replies. I have to work hard to discover what it is you are actually replying to. The problem seems to stem from your top-posting style. *snip* > -- > Derek Parnell > Melbourne, Australia > 24/04/2005 8:57:37 PM Thanks for the input. I'll work on it. I see many reply styles here. Top posting, bottom posting, insert posting, etcetera. So far, I have only heard complaints about me top posting, which is the deault for Outlook Express and my prefered style.... and one complaint about not having line breaks in my paragraphs. You may have already notice that I have been trying to remember to insert line breaks manually into my paragraphs, for the sake of people reading my posts through the web interface, or through any interface that doesn't have automatic word wrap. Again, thanks for pointing out your difficulty in dealing with the top down style, and extended context quoting. The feedback is appreciated. TZ |
April 24, 2005 Re: opCmp - any consensus | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | "Derek Parnell" <derek@psych.ward> wrote in message news:mrypw5e0gsvi.zf6thq5km4k2.dlg@40tude.net... > On Sat, 23 Apr 2005 21:40:17 -0500, TechnoZeus wrote: > > > Well it just wasn't all that obvious. Thanks for clearing it up. > > -- > Derek Parnell > Melbourne, Australia > 24/04/2005 9:00:39 PM You're welcome. TZ |
April 24, 2005 Re: opCmp - any consensus | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | "Derek Parnell" <derek@psych.ward> wrote in message news:mrypw5e0gsvi.zf6thq5km4k2.dlg@40tude.net... > On Sat, 23 Apr 2005 21:40:17 -0500, TechnoZeus wrote: > >> "StarCrossed" <StarCrossed_member@pathlink.com> wrote in message news:d4ajh6$26kn$1@digitaldaemon.com... >>> In article <d4ad7d$21ev$1@digitaldaemon.com>, TechnoZeus says... >>>> >>>>And what of those cases where it is known but still not implemented? Better to have a default. If someone wants to make something not comparable, then they can override the default accordingly, I would think... just as Walter is talking about doing in the case of the argument being null. >>>> >>>>This makes much more sense than to remove useful functionality from the language. >>> >>> total BS >>> >>> Do u program? >>> >>> >> >> That doesn't even deserve an answer, but.. yes. > > Well it just wasn't all that obvious. Thanks for clearing it up. Now _that's_ comedy. LOL Derek, you're a gem. And what a tonic for the morning after the night before? :-) |
Copyright © 1999-2021 by the D Language Foundation