Date: Fri, 11 Feb 2022 20:43:21 +0100
Sorry for not commenting your proposals on the merits: from a quick
fly by I don't see the most important missing feature from C# enums
that is the bitwise operator enabled for enums with [Flags]
attribute[1]. Even ObjectiveC has a similar feature (NS_OPTIONS
enums[2]). Sure, it's possible to add overloads[3] for bitwise
operators but it would be much more handy if the c++ standard
supported natively this behavior with a descriptor of sort. I highly
recommend to add it in your proposal because it would be sad to
discuss again about enums after years and forgetting this once again.
Regards,
Francesco
[1] https://docs.microsoft.com/en-us/dotnet/api/system.flagsattribute?view=net-6.0
[2] https://developer.apple.com/documentation/swift/objective-c_and_c_code_customization/grouping_related_objective-c_constants#2990347
[3] https://gist.github.com/derofim/0188769131c62c8aff5e1da5740b3574
On Fri, 11 Feb 2022 at 19:45, Alexander Christensen via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Hi,
>
> So I have been considering / missing some features from enums, more speficially "enum class"'es,
> some of which can be found in e.g. C#. These are nice-to-have, and could in some cases be a really
> great help during development and logging.
>
> Ever tried to log the value of an enum and being dissappointed to only find an integer, requiring
> a table lookup?
>
> My first ever attempt to write a proposal can be found in the compiled pdf found here:
> https://github.com/alexpanter/cpp-enum-proposal/blob/master/report.pdf
>
> It very likely contains errors, inconsistencies, or other undesired appearances. So I apologize in advance for these.
> I merely wanted to see, if there were any interest in something like this, as well as how I could proceed.
>
> Best,
> Alexander
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
fly by I don't see the most important missing feature from C# enums
that is the bitwise operator enabled for enums with [Flags]
attribute[1]. Even ObjectiveC has a similar feature (NS_OPTIONS
enums[2]). Sure, it's possible to add overloads[3] for bitwise
operators but it would be much more handy if the c++ standard
supported natively this behavior with a descriptor of sort. I highly
recommend to add it in your proposal because it would be sad to
discuss again about enums after years and forgetting this once again.
Regards,
Francesco
[1] https://docs.microsoft.com/en-us/dotnet/api/system.flagsattribute?view=net-6.0
[2] https://developer.apple.com/documentation/swift/objective-c_and_c_code_customization/grouping_related_objective-c_constants#2990347
[3] https://gist.github.com/derofim/0188769131c62c8aff5e1da5740b3574
On Fri, 11 Feb 2022 at 19:45, Alexander Christensen via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Hi,
>
> So I have been considering / missing some features from enums, more speficially "enum class"'es,
> some of which can be found in e.g. C#. These are nice-to-have, and could in some cases be a really
> great help during development and logging.
>
> Ever tried to log the value of an enum and being dissappointed to only find an integer, requiring
> a table lookup?
>
> My first ever attempt to write a proposal can be found in the compiled pdf found here:
> https://github.com/alexpanter/cpp-enum-proposal/blob/master/report.pdf
>
> It very likely contains errors, inconsistencies, or other undesired appearances. So I apologize in advance for these.
> I merely wanted to see, if there were any interest in something like this, as well as how I could proceed.
>
> Best,
> Alexander
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2022-02-11 19:43:32