Is there any interest in fixing opEquals and opCmp in the
spirit(*) of [1]?
Translating the basic idea into the D world would mean:
- Drop opEquals
- Encode the type of comparison in the return type of opCmp
- Adapt lowering
Why?
- Simplicity: there is always only one function that needs
On Saturday, 13 May 2017 at 12:11:49 UTC, Fool wrote:
Is there any interest in fixing opEquals and opCmp in the
spirit(*) of [1]?
Translating the basic idea into the D world would mean:
- Drop opEquals
- Encode the type of comparison in the return type of opCmp
- Adapt lowering
Why
On Saturday, 13 May 2017 at 12:53:33 UTC, Nicholas Wilson wrote:
For most types equality exists (i.e. are all members equal?),
but ordering is nonsensical.
How does this relate to what I wrote?
If you want to support equality only, implement opCmp with return
type Equality. (In Herb's proposa
On Sat, May 13, 2017 at 01:21:12PM +, Fool via Digitalmars-d wrote:
> On Saturday, 13 May 2017 at 12:53:33 UTC, Nicholas Wilson wrote:
[...]
> > 3) you can do that already. w.r.t sort you pass a predicate
> > (defaulting to "less") for which ordering is assumed to exist, if it
> > doesn't then
On Saturday, 13 May 2017 at 14:17:24 UTC, H. S. Teoh wrote:
Another misunderstanding. Currently, there is no means to
express that 'less' models a partial order vs. a linear order.
Wrong. Andrei specifically stated before that opCmp may model
a partial order, i.e., returning 0 may indicate "n
On Saturday, 13 May 2017 at 14:17:24 UTC, H. S. Teoh wrote:
Andrei specifically stated before that opCmp may model a
partial order, i.e., returning 0 may indicate "not comparable"
rather than "equal".
Well, that's unsound.
Example: 'is (proper) subset of'
Given the sets a:= {1} and b:= {2},
On Saturday, 13 May 2017 at 15:00:27 UTC, Fool wrote:
On Saturday, 13 May 2017 at 14:17:24 UTC, H. S. Teoh wrote:
Andrei specifically stated before that opCmp may model a
partial order, i.e., returning 0 may indicate "not comparable"
rather than "equal".
Well, that's unsound.
Example: 'is (p
On Saturday, 13 May 2017 at 15:05:02 UTC, Stanislav Blinov wrote:
In this case, typeof(a) should not be the same as typeof(b),
which can be handled correctly by opCmp.
Now you are trolling me. ;-)
Obviously a and b share the same type. They are sets.
On 13.05.2017 16:17, H. S. Teoh via Digitalmars-d wrote:
On Sat, May 13, 2017 at 01:21:12PM +, Fool via Digitalmars-d wrote:
On Saturday, 13 May 2017 at 12:53:33 UTC, Nicholas Wilson wrote:
[...]
3) you can do that already. w.r.t sort you pass a predicate
(defaulting to "less") for which o
On Saturday, May 13, 2017 20:52:48 Timon Gehr via Digitalmars-d wrote:
> On 13.05.2017 16:17, H. S. Teoh via Digitalmars-d wrote:
> > On Sat, May 13, 2017 at 01:21:12PM +, Fool via Digitalmars-d wrote:
> >> On Saturday, 13 May 2017 at 12:53:33 UTC, Nicholas Wilson wrote:
> > [...]
> >
> >>> 3)
On Saturday, 13 May 2017 at 14:17:24 UTC, H. S. Teoh wrote:
Andrei specifically stated before that opCmp may model a
partial order, i.e., returning 0 may indicate "not comparable"
rather than "equal". And this is why opEquals is necessary: to
distinguish between "not comparable" and "equal".
On Saturday, 13 May 2017 at 18:52:48 UTC, Timon Gehr wrote:
I can't seem to find the post you are referring to but IIRC it
was immediately destroyed completely.
It was probably in this thread:
http://forum.dlang.org/post/dhrtitehdkcgnlmuk...@forum.dlang.org
And as one can see generic suppor
12 matches
Mail list logo