View mode: basic / threaded / horizontal-split · Log in · Help
April 17, 2005
Re: Object.opCmp - about time we came to a decision
Ben Hinkle wrote:
...

>>P.S. Anyone advise on how to get a clickable message link from an entry in 
>>Outlook Express? I know it's done, because some of you do it. :-)
> 
> 
> That would be nice because I only know how to point to the forum page on the 
> DigitalMars site and that only takes you to a particular message and not the 
> thread. 

If you go to http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D, 
and click on the "Subject" tab, you can see the message titles. Since 
they're alphabetized, the first page currently has entries for "" (no 
subject), "!(null is hkey) ??", and other subjects which begin with 
punctuation symbols. You'll probably need to click the "More" button a 
few times to get close to what you're looking for.

(Is that what you want or did I answer the wrong question?)

-- 
jcc7
http://jcc_7.tripod.com/d/
April 17, 2005
Re: Object.opCmp - about time we came to a decision
"J C Calvarese" <jcc7@cox.net> wrote in message 
news:d3ume6$2h3g$1@digitaldaemon.com...
> Ben Hinkle wrote:
> ...
>
>>>P.S. Anyone advise on how to get a clickable message link from an entry 
>>>in Outlook Express? I know it's done, because some of you do it. :-)
>>
>>
>> That would be nice because I only know how to point to the forum page on 
>> the DigitalMars site and that only takes you to a particular message and 
>> not the thread.
>
> If you go to http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D, and 
> click on the "Subject" tab, you can see the message titles. Since they're 
> alphabetized, the first page currently has entries for "" (no subject), 
> "!(null is hkey) ??", and other subjects which begin with punctuation 
> symbols. You'll probably need to click the "More" button a few times to 
> get close to what you're looking for.
>
> (Is that what you want or did I answer the wrong question?)

I meant all I know how to do is this:
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/6809
How can I get a link to the whole thread instead of just a message in the 
thread?
April 18, 2005
Re: Object.opCmp - about time we came to a decision
Ben Hinkle wrote:
> "J C Calvarese" <jcc7@cox.net> wrote in message 
> news:d3ume6$2h3g$1@digitaldaemon.com...
> 
>>Ben Hinkle wrote:
>>...
>>
>>
>>>>P.S. Anyone advise on how to get a clickable message link from an entry 
>>>>in Outlook Express? I know it's done, because some of you do it. :-)
>>>
>>>
>>>That would be nice because I only know how to point to the forum page on 
>>>the DigitalMars site and that only takes you to a particular message and 
>>>not the thread.
>>
>>If you go to http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D, and 
>>click on the "Subject" tab, you can see the message titles. Since they're 
>>alphabetized, the first page currently has entries for "" (no subject), 
>>"!(null is hkey) ??", and other subjects which begin with punctuation 
>>symbols. You'll probably need to click the "More" button a few times to 
>>get close to what you're looking for.
>>
>>(Is that what you want or did I answer the wrong question?)
> 
> 
> I meant all I know how to do is this:
> http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/6809
> How can I get a link to the whole thread instead of just a message in the 
> thread? 
> 
> 

Oops, I misunderstood. I don't think I've seen anyone do that (maybe it 
doesn't work for me since I use Thunderbird). Would it show up in a 
newsreader or a web-browser?

Or do you mean one of the archive pages, such as 
http://www.digitalmars.com/d/archives/digitalmars/D/13965.html?

There's a separate main page for each newsgroup (but Walter hasn't run 
his update process in a while, so not all of the newsgroups even have a 
page yet):

http://www.digitalmars.com/d/archives/digitalmars/D/index.html
http://www.digitalmars.com/d/archives/digitalmars/D/dtl/index.html
http://www.digitalmars.com/d/archives/digitalmars/D/bugs/index.html
http://www.digitalmars.com/d/archives/D/gnu/index.html
http://www.digitalmars.com/d/archives/index.html

-- 
jcc7
http://jcc_7.tripod.com/d/
April 18, 2005
Re: Object.opCmp - about time we came to a decision
J C Calvarese wrote:
> Ben Hinkle wrote:
> 
>> "J C Calvarese" <jcc7@cox.net> wrote in message 
>> news:d3ume6$2h3g$1@digitaldaemon.com...
>> 
>>> Ben Hinkle wrote: ...
>>> 
>>> 
>>>>> P.S. Anyone advise on how to get a clickable message link
>>>>> from an entry in Outlook Express? I know it's done, because
>>>>> some of you do it. :-)
>>>> 
>>>> 
>>>> 
>>>> That would be nice because I only know how to point to the
>>>> forum page on the DigitalMars site and that only takes you to a
>>>> particular message and not the thread.
>>> 
>>> 
>>> If you go to 
>>> http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D, and
>>> click on the "Subject" tab, you can see the message titles. Since
>>> they're alphabetized, the first page currently has entries for ""
>>> (no subject), "!(null is hkey) ??", and other subjects which
>>> begin with punctuation symbols. You'll probably need to click the
>>> "More" button a few times to get close to what you're looking
>>> for.
>>> 
>>> (Is that what you want or did I answer the wrong question?)
>> 
>> 
>> 
>> I meant all I know how to do is this: 
>> http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/6809 How
>> can I get a link to the whole thread instead of just a message in 
>> the thread?
>> 
> 
> Oops, I misunderstood. I don't think I've seen anyone do that (maybe
> it doesn't work for me since I use Thunderbird). Would it show up in
> a newsreader or a web-browser?
> 
> Or do you mean one of the archive pages, such as 
> http://www.digitalmars.com/d/archives/digitalmars/D/13965.html?
> 
> There's a separate main page for each newsgroup (but Walter hasn't
> run his update process in a while, so not all of the newsgroups even
> have a page yet):

Man, we should collect money to give him a Linux box. ;-)
They do stuff like that by themselves.

> http://www.digitalmars.com/d/archives/digitalmars/D/index.html 
> http://www.digitalmars.com/d/archives/digitalmars/D/dtl/index.html 
> http://www.digitalmars.com/d/archives/digitalmars/D/bugs/index.html 
> http://www.digitalmars.com/d/archives/D/gnu/index.html 
> http://www.digitalmars.com/d/archives/index.html
>
April 18, 2005
Re: Object.opCmp - about time we came to a decision
xs0 wrote:
> BTW, after some thinking, opEquals should do the same; you don't know 
> whether something is equal or not (unless it is identity-equal), so you 
> can't just say it isn't.

To me, not defining an opEquals is basically stating that two object 
references are equal only by referring to one and the same object.

> To sum up, I believe these should be the default implementations:
> 
> int opCmp(Object o)
> {
> // basically doesn't work, but explains what should be done
>     if (this==o) return 0;
>     if (this.classinfo==o.classinfo) {
>         throw new SomeException("You need to define opCmp(Object) for 
> "~o.classinfo.name);
>     } else {
>         throw new SomeException("You need to define opCmp(Object) in " ~ 
> this.classinfo.name ~ " that can compare with " ~ o.classinfo.name);
>     }
> }
<snip top of upside-down reply>

I still don't get what practical use this idea really has.

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
April 18, 2005
Re: Object.opCmp - about time we came to a decision
xs0 wrote:
> Stewart Gordon wrote:
<snip>
>> Why should applications tell their users to define opCmp(Object)?
> 
> Well, what I said and "comparison not defined for type Blah" are about 
> equally useful to the users (not at all), yet my message is useful at 
> least to coders? And if you just say it's not defined, everybody will 
> come filing bugs about how their opCmp(Blah) actually is defined :)

The whole point of exception messages is to be addressed to the user. 
Almost any exception message is bound to find its way into production 
code one day.  And so the "You need to" notation truly is blaming the 
user for a fault of the programmer.

On the other hand, simply saying "comparison not defined for type Blah" 
or similar, while equally meaningless to the user, doesn't label anyone 
as at fault, and arguably looks more like indication of a bug than a 
bogus message of action required from the user.

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
April 18, 2005
Re: Object.opCmp - about time we came to a decision
Walter wrote:
<snip>
> You're right. At the moment, it is not practical to create a class that
> wraps a float because the comparisons won't be able to handle unordered
> values.
<snip>

Moreover, unordered values can't be used in binary search trees and the 
like (one thing Java uses orderings for).  But maybe it's possible to 
support partially ordered types in such a way that they'll be 
distinguishable from totally ordered types.  And maybe even implement a 
topological sort on partial orderings.

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
April 18, 2005
Re: Object.opCmp - about time we came to a decision
Sean Kelly wrote:
> In article <d3p3gt$12bt$1@digitaldaemon.com>, Kris says...
<snip>
>>Very true. But if one of them exists for any given class, that object is now
>>exhibiting comparison-traits of the 'deep' variety. If this is done for one,
>>then does it not follow it should be done for the other? In other words, is
>>the Comparable really an indirect indicator of 'deep' comparison? And, does
>>this lead to a suggestion for one method rather than two of them? Is it
>>really /so/ beneficial to have two seperate methods for comparison purposes?

Yes, so that:
- equality comparisons can be made more efficient than ordered comparisons
- unequal objects can rank equally in order (such as database records 
with matching sort keys).

<snip>
>>Defaulting opEqual() to identity conflicts with its role, and opens the door
>>to both misinterpretation and buggy code. Naturally, there's potential for
>>compromise all over the place. But if opEqual() remains in Object, then it
>>should likely have an assert(0), since the developer should actually be
>>using 'is' instead of '=='. But this is bogus too, since the error should be
>>thrown at compile-time rather than runtime. Thus, opEqual() really should
>>come out the root object, such that appropriate compile-time errors are
>>thrown.
<snip>

opEqual?  What happened to the 's'?

As I've said a few times, my understanding is that if someone didn't 
define opEquals, he/she/it really meant that object references of this 
class are equal only by being one and the same.  So what should happen 
to AAs when no opEquals is defined?  Should they default to ===/is 
instead of == ?  Or should they, artificially and not very logically, be 
implicitly prevented from use as AA keys?  My vote would go to the 
former, and this is the behaviour provided by the current default opEquals.

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
April 18, 2005
Re: Object.opCmp - about time we came to a decision
Stewart Gordon wrote:
> xs0 wrote:
> 
>> BTW, after some thinking, opEquals should do the same; you don't know 
>> whether something is equal or not (unless it is identity-equal), so 
>> you can't just say it isn't.
> 
> 
> To me, not defining an opEquals is basically stating that two object 
> references are equal only by referring to one and the same object.

To me, not defining an opEquals is basically stating you won't compare 
objects with ==. IMHO, if you want to compare references, you have is, 
and if you're writing templates that use ==, you should define opEquals 
anyway.


>> To sum up, I believe these should be the default implementations:
>>
>> int opCmp(Object o)
>> {
>> // basically doesn't work, but explains what should be done
>>     if (this==o) return 0;
>>     if (this.classinfo==o.classinfo) {
>>         throw new SomeException("You need to define opCmp(Object) for 
>> "~o.classinfo.name);
>>     } else {
>>         throw new SomeException("You need to define opCmp(Object) in " 
>> ~ this.classinfo.name ~ " that can compare with " ~ o.classinfo.name);
>>     }
>> }
> 
> <snip top of upside-down reply>
> 
> I still don't get what practical use this idea really has.

Well, I thought that one of the major issues with opCmp and the like is 
that they're defined in Object, which provides a problematic default 
implementation, that currently compares based on their objects addresses 
in memory, which is horrible.

The other issue people had is that they define Foo.opCmp(Foo) and it 
doesn't work.

I was trying to address those two issues by having Object still contain 
those methods (which is imho good) yet have them work in a GC-safe way, 
while not assuming any ordering/equalness at all, and if they do throw 
an exception, it might as well be something useful to the coder, which 
obviously thought that his code was going to be called, but it didn't.


xs0
April 18, 2005
Re: Object.opCmp - about time we came to a decision
Stewart Gordon wrote:
> xs0 wrote:
> 
>> Stewart Gordon wrote:
> 
> <snip>
> 
>>> Why should applications tell their users to define opCmp(Object)?
>>
>>
>> Well, what I said and "comparison not defined for type Blah" are about 
>> equally useful to the users (not at all), yet my message is useful at 
>> least to coders? And if you just say it's not defined, everybody will 
>> come filing bugs about how their opCmp(Blah) actually is defined :)
> 
> 
> The whole point of exception messages is to be addressed to the user. 
> Almost any exception message is bound to find its way into production 
> code one day.  And so the "You need to" notation truly is blaming the 
> user for a fault of the programmer.
> 
> On the other hand, simply saying "comparison not defined for type Blah" 
> or similar, while equally meaningless to the user, doesn't label anyone 
> as at fault, and arguably looks more like indication of a bug than a 
> bogus message of action required from the user.

If the user ever sees a message from opCmp(), the app is totally not 
ready for use, I mean, it's such a basic thing.

So, I was kind of assuming that the user would never see such a message, 
but the developer will.

In any case, the point wasn't the exact wording. It can easily be 
personless.


xs0
2 3 4 5 6 7 8 9
Top | Discussion index | About this forum | D home