Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Prefer spaceship operator instead of specific </> operators #509

Closed as not planned

Description

@jviotti

We have a few operator< in the codebase that should become spaceship operators instead

Activity

  1. suprith-hub commented on Apr 27, 2024

    @suprith-hub
    Contributor

    Hi @jviotti I have questions on this:

    1. Should the spaceship operator be supported only for C++20 by conditional compilation?
    2. Should it support string_ordering, or weak_ordering or partial_ordering?
  2. jviotti commented on Apr 29, 2024

    @jviotti
    MemberAuthor

    @era-cell On the first question, yes. We only support C++20 and later. Don't worry about older versions! On ordering, the strongest it can be. I believe we should be able to implement strong ordering in this case, but maybe I'm wrong. If you give it a shot, I guess you'll find out :)

  3. jviotti commented on May 7, 2024

    @jviotti
    MemberAuthor

    I ended up needing better comparison support for the schema compiler. Turns out doing the spaceship operator on the JSON class was not possible though. We had to go explicit. Check the linked PR for more details if you are curious

  4. suprith-hub commented on May 10, 2024

    @suprith-hub
    Contributor

    Hey @jviotti. So, is that because of that spaceship operator cannot be supported in some compilers?? or is it versions problem

  5. jviotti commented on May 10, 2024

    @jviotti
    MemberAuthor

    Compiler support was good. The problem is the JSON class. By definition, the JSON class represents many containers at once. i.e. it can be an object or an array depending on what the user wants, and I found it hard to get the "top-level" JSON class to agree on a specific type of ordering between these two containers. The spaceship operator was originally introduced to save boilerplate, but in this case, being explicit allows us to bridge those differences

  6. suprith-hub commented on May 10, 2024

    @suprith-hub
    Contributor

    So, that means spaceship operator somehow changed the ordering of attributes to make a comparison or after the comparison?

  7. jviotti commented on May 10, 2024

    @jviotti
    MemberAuthor

    It was about strong/partial/weak ordering! Different types encapsulated in JSON had different characteristics

  8. suprith-hub commented on May 13, 2024

    @suprith-hub
    Contributor

    It was about strong/partial/weak ordering! Different types encapsulated in JSON had different characteristics

    I assume partial ordering was not implementable.. i.g i.e, for all nested data types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions