C++ Logo

std-proposals

Advanced search

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

From: David Brown <david_at_[hidden]>
Date: Mon, 25 Sep 2023 11:08:52 +0200
On 23/09/2023 20:35, Arthur O'Dwyer via Std-Proposals wrote:
> On Sat, Sep 23, 2023 at 2:13 PM Chris Gary via Std-Proposals
> <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> wrote:
>
>
> *move and forward can be defined without compiler hooks. This is
> where the language does not make architectural assumptions.*
> *typeid() cannot.*
>
>
> Right.
>
> In general: Architecture is disrupted when an unwanted or
> incompatible role is introduced or required by a dependency. All C++
> applications are now dependent on the standard library [...] It must
> be possible to effectively use the language without the library.
>
>
> I agree with you, as a general rule. But, as everyone's saying, you're
> re-litigating a decision that was already made in
> - C++20, with the type of `auto x = (1 <=> 2)` being
> std::strong_ordering and the type of `auto x = (1. <=> 2)` being
> std::partial_ordering;
> and that decision was merely in line with the decisions C++ made in
> - C++20, with basically everything in coroutines;
> - C++17, with structured bindings' being dependent on std::tuple_size
> and std::tuple_element <https://eel.is/c++draft/dcl.struct.bind#4>;
> - C++11, with ranged-for-loops' being dependent on
> <https://eel.is/c++draft/stmt.ranged#1.3> the magic identifiers "begin"
> and "end", and the type of `auto x = {1,2}` being
> std::initializer_list<int>;
> - C++98, with the type of `auto x = typeid(int)` being std::type_info.
>
> You can't invoke a general principle to undo a specific
> three-years-out-the-door decision, especially when that decision is in
> line with two-decade-old decisions.
>

It is /way/ older than that - preceding C++ itself, and preceding
standardised C. K&R C had the "sizeof" operator return the type
"size_t", defined in <stdlib.h> and <stddef.h>. So having language
features rely on definitions from standard library headers is a 50 year
old tradition, not merely two decades old!

Received on 2023-09-25 09:09:01