C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Let spaceship return an int

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 25 Sep 2023 01:28:58 +0300
On Mon, 25 Sept 2023 at 01:15, Chris Gary via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>>
>> So what's the problem with the current implementation?
>
>
> #include <compare> // <-- has a bigger maintenance footprint than it seems. Did I use a library feature? No, I just wanted to use <=>...
>
> That's really it for now.
> The rest is just "let me use my own int-alike" and why that is possible.

Well, the problem is that now you're saying "my own int-alike", and in
the OP you said "hey, just int". The semantics of the standard
could indeed be retrofitted so that a spaceship is required to return
a type that models a concept, both syntactically and semantically
(and plain ints just won't), instead of requiring that it returns That
Type In The Standard Library. That fits the model,
doesn't compromise the model, and would allow you to provide your own ordering
types instead of having to use the standard ones, for whichever
reason, including polyfilling for a buggy stdlib.

That's actually something that's plausible and might even sail in the
committee. Just allowing whichever return type with whichever
semantics is less likely to sail.

In other words, fair amounts of confusion could've been saved if you'd
gone with "I want to use my own strong_ordering-like type".

> I'm getting responses as though I've somehow gone home-to-home and kicked their pets.

I daresay you're also getting responses that are much more level-headed. :)

> When you present an idea in a forum and the first thing you get from a a few people who, for all intents and purposes, you should expect to behave in a professional manner spit out one "go foad" after another its hard to gauge the community temperament.

I don't think Thiago or I have told you to "go foad". We understand
the possible need for avoiding a direct and unavoidable dependency to
a stdlib,
for multiple reasons, including ABI instability. Thiago in particular
has oodles of experiences with that.

Received on 2023-09-24 22:29:12