Discussion Thread: DIP 1042--ProtoObject--Community Review Round 1
dominikus at scherkl.de
Fri Jan 14 03:04:28 UTC 2022
On Friday, 14 January 2022 at 02:22:13 UTC, H. S. Teoh wrote:
> On Fri, Jan 14, 2022 at 01:48:06AM +0000, Dom DiSc via
> Digitalmars-d wrote: [...]
>> > This makes me question the wisdom of putting opCmp in the
>> > common base of all classes. If only a small subset of
>> > classes will be comparable with each other
>> This is a misunderstanding.
>> First of all, you don't compare classes, but objects
>> (instances) of
>> the same class.
>> And the majority of objects may well be comparable.
> Majority? Hardly. How should opCmp for std.stdio.File be
Oh, come on. Every browser need to order files. Of course there
are endless different orders (by size, by name, by date, ...) but
there IS an order - and one need to be applied if you want to
show the user a list. How else can you create a list other than
creating an order?!?
> What does it even mean for one File to be "less than" another?
It means it should be shown before the other one in a list.
And this also makes clear why this order is only partial, because
maybe you have some filter. All files filtered out are
non-comparable to ones within the list, because they are not
shown, neither before nor after. And of course they are not equal.
> What about a Socket?
Any kind of ID?
> What about a Widget or Window?
z-Order? - at least for windows that really matters.
> What about a ServerConnection?
> What about an ObjectFactory?
Nah, maybe for something too generic order doesn't matter so
much, but at least for the majority of your examples there were
meaningful orders, don't you think?
More information about the Digitalmars-d