digitalmars.D.bugs - [CBug] opCmp and Sort
- J Anderson (23/23) May 03 2004 I'm just bring this up (again) so I can add it to the Pending Peeves
- J Anderson (5/26) May 03 2004 I'll add it to the feature request list if everyone else agrees, if bigW...
- Stewart Gordon (13/26) May 04 2004 The pending peeves list is free for all to add stuff to. No need for
- J Anderson (5/10) May 04 2004 I was wondering whether is there is a good reason to keep opCmp the way
- Stewart Gordon (15/17) May 05 2004 Less than none that I can see.
- J Anderson (5/18) May 05 2004 I guess the default one could be useful for associative arrays
- Stewart Gordon (9/12) May 05 2004 They already won't work if the type has no ordering.
- J Anderson (4/12) May 05 2004 --
- Ivan Senji (4/21) May 05 2004 I would also vote for deprecating Object.opEquals because it is
I'm just bring this up (again) so I can add it to the Pending Peeves list if bigW (or everyone else) agrees. When sorting you have to use: class A { int opCmp(Object x) { A a = (a) x; if (a) ... } } The logical solution is: class A { int opCmp(A x) { ... } } Why can't this be so? -- -Anderson: http://badmama.com.au/~anderson/
May 03 2004
J Anderson wrote:I'm just bring this up (again) so I can add it to the Pending Peeves list if bigW (or everyone else) agrees.I'll add it to the feature request list if everyone else agrees, if bigW agrees I'll put it in the pending peeves.When sorting you have to use: class A { int opCmp(Object x) { A a = (a) x; if (a) ... } } The logical solution is: class A { int opCmp(A x) { ... } } Why can't this be so?-- -Anderson: http://badmama.com.au/~anderson/
May 03 2004
J Anderson wrote:I'm just bring this up (again) so I can add it to the Pending Peeves list if bigW (or everyone else) agrees.The pending peeves list is free for all to add stuff to. No need for any authoritative or unanimous seconding.When sorting you have to use: class A { int opCmp(Object x)<snip>The logical solution is: class A { int opCmp(A x)<snip> This is another case of the problem that manifests in associative arrays, but I agree it's worth bringing up as a separate issue. Also, it should work with structs rather than having to set up a TypeInfo class. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
May 04 2004
Stewart Gordon wrote:J Anderson wrote:I was wondering whether is there is a good reason to keep opCmp the way it is. -- -Anderson: http://badmama.com.au/~anderson/I'm just bring this up (again) so I can add it to the Pending Peeves list if bigW (or everyone else) agrees.The pending peeves list is free for all to add stuff to. No need for any authoritative or unanimous seconding.
May 04 2004
J Anderson wrote: <snip>I was wondering whether is there is a good reason to keep opCmp the way it is.Less than none that I can see. http://www.digitalmars.com/drn-bin/wwwnews?D/26144 We have a simple solution that wouldn't break backward compatibility AFAICS. 1. Fix sort and AAs to work with a self-specific opCmp. 2. Deprecate Object.opCmp. 3. Change AAs so that if the key type has no matching opCmp, or only a deprecated one, it will skip that stage of the lookup. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
May 05 2004
Stewart Gordon wrote:J Anderson wrote: <snip>I was wondering whether is there is a good reason to keep opCmp the way it is.Less than none that I can see. http://www.digitalmars.com/drn-bin/wwwnews?D/26144 We have a simple solution that wouldn't break backward compatibility AFAICS. 1. Fix sort and AAs to work with a self-specific opCmp. 2. Deprecate Object.opCmp.3. Change AAs so that if the key type has no matching opCmp, or only a deprecated one, it will skip that stage of the lookup. Stewart.I guess the default one could be useful for associative arrays implementations who use a binary sort (ie stl's maps). -- -Anderson: http://badmama.com.au/~anderson/
May 05 2004
J Anderson wrote: <snip>I guess the default one could be useful for associative arrays implementations who use a binary sortThey already won't work if the type has no ordering.(ie stl's maps).I somehow doubt that STL is the only one. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
May 05 2004
Stewart Gordon wrote:J Anderson wrote: <snip>Oh. Your right then.I guess the default one could be useful for associative arrays implementations who use a binary sortThey already won't work if the type has no ordering.-- -Anderson: http://badmama.com.au/~anderson/(ie stl's maps).I somehow doubt that STL is the only one. Stewart.
May 05 2004
"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message news:c7ac8o$d36$1 digitaldaemon.com...J Anderson wrote: <snip>I would also vote for deprecating Object.opEquals because it is totally unneaded and a potential cause of bugs.I was wondering whether is there is a good reason to keep opCmp the way it is.Less than none that I can see. http://www.digitalmars.com/drn-bin/wwwnews?D/26144 We have a simple solution that wouldn't break backward compatibility AFAICS. 1. Fix sort and AAs to work with a self-specific opCmp. 2. Deprecate Object.opCmp.3. Change AAs so that if the key type has no matching opCmp, or only a deprecated one, it will skip that stage of the lookup. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
May 05 2004