C++ Logo

sg16

Advanced search

Re: [isocpp-sg16] [P3560] std::meta::exception::what()

From: Victor Zverovich <victor.zverovich_at_[hidden]>
Date: Sat, 11 Jan 2025 09:00:10 -0800
The usual approach is to provide a char option (string_view in your case)
that works properly in the common and the most important from the future
evolution case of UTF-8 literal encoding. It would also be consistent with
existing exceptions and the decision we made for P3068:
https://github.com/cplusplus/papers/issues/1754#issuecomment-2299368606.
You might want to elaborate why you can't optionally provide a u8 overload
in addition to that.

Cheers,
Victor

On Sat, Jan 11, 2025 at 8:50 AM Barry Revzin via SG16 <sg16_at_[hidden]>
wrote:

> Hey all,
>
> Peter and I will have a paper in this upcoming mailing, which can be found
> here (https://isocpp.org/files/papers/P3560R0.html). We're proposing that
> error handling in reflection should use exceptions to be recoverable, now
> that it is possible to have recoverable exceptions during constant
> evaluation.
>
> The part that concerns this list is... what type should
> std::meta::exception::what() return: std::string_view or
> std::u8string_view?
>
>
> - Argument for u8string_view: this is the principled, type system
> correct answer.
> - Argument for string_view: this is the only type for which there is
> absolutely any support whatsoever in the standard library to do anything.
>
> As you all know, this is an area in which I have no expertise (neither
> current nor, if I'm being honest, desired). This discussion will have to go
> to SG16 eventually, so I wanted to just expedite the process.
>
> As we point out, P2996 used to originally use string_view everywhere and
> we changed to provide a dual interface (e.g. identifier_of() and
> u8identifier_of() both exist). That's not really feasible for
> std::meta::exception, we kind of have to pick one.
>
> Thanks,
>
> Barry
> --
> SG16 mailing list
> SG16_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/sg16
>

Received on 2025-01-11 17:00:22