October 28, 2022

On Friday, 28 October 2022 at 15:29:15 UTC, ryuukk_ wrote:

>

On Friday, 28 October 2022 at 14:49:28 UTC, Nick Treleaven wrote:

>

On Friday, 28 October 2022 at 14:47:27 UTC, ryuukk_ wrote:

>

On Friday, 28 October 2022 at 14:43:54 UTC, Nick Treleaven wrote:

>

Has C or C++ actually added sum types to their standards?

It was proposed and feedback was favorable, it's only just a matter of when now

Do you have a link? I saw the circle compiler extension and feedback wasn't all favourable. Standardising something is long and arduous.

Here is the latest revision i could find

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1371r3.pdf

And Bjarne Stroustrup thoughts

https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2021/p2411r0.pdf

That's pattern matching (I probably confused things mentioning circle). Presumably sum types would still be a library feature in C++.

October 28, 2022

On Friday, 28 October 2022 at 15:45:51 UTC, Nick Treleaven wrote:

>

On Friday, 28 October 2022 at 15:29:15 UTC, ryuukk_ wrote:

>

On Friday, 28 October 2022 at 14:49:28 UTC, Nick Treleaven wrote:

>

On Friday, 28 October 2022 at 14:47:27 UTC, ryuukk_ wrote:

>

On Friday, 28 October 2022 at 14:43:54 UTC, Nick Treleaven wrote:

>

Has C or C++ actually added sum types to their standards?

It was proposed and feedback was favorable, it's only just a matter of when now

Do you have a link? I saw the circle compiler extension and feedback wasn't all favourable. Standardising something is long and arduous.

Here is the latest revision i could find

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1371r3.pdf

And Bjarne Stroustrup thoughts

https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2021/p2411r0.pdf

That's pattern matching (I probably confused things mentioning circle). Presumably sum types would still be a library feature in C++.

You didn't read #10 Future Work

>

10.1 Language Support for Variant
The design of this proposal also accounts for a potential language support for variant. It achieves this by keeping
the alternative pattern flexible for new extensions via < new_entity > pattern.
Consider an extension to union that allows it to be tagged by an integral, and has proper lifetime management
such that the active alternative need not be destroyed manually.

October 28, 2022

On Friday, 28 October 2022 at 14:49:28 UTC, Nick Treleaven wrote:

>

On Friday, 28 October 2022 at 14:47:27 UTC, ryuukk_ wrote:

>

On Friday, 28 October 2022 at 14:43:54 UTC, Nick Treleaven wrote:

>

Has C or C++ actually added sum types to their standards?

It was proposed and feedback was favorable, it's only just a matter of when now

Do you have a link? I saw the circle compiler extension and feedback wasn't all favourable. Standardising something is long and arduous.

The feature on ISO C++ is only planned post-C++26, as you say, is long and arduous.

Many hardliners don't like Circle regardless of the feature anyway.

October 28, 2022

On Friday, 28 October 2022 at 12:34:42 UTC, ryuukk_ wrote:

>

On Friday, 28 October 2022 at 09:35:06 UTC, Sergey wrote:

>

On Thursday, 27 October 2022 at 15:14:30 UTC, ryuukk_ wrote:

>

PHP also got builtin sumtype and pattern matching

https://laravel-news.com/modern-php-features-explained

https://news.ycombinator.com/item?id=33357318

D lagging behind most languages now :/

D also has them: https://dlang.org/phobos/std_sumtype.html#match

std.sumtype is buggy, it's slow and it is a template

C/C++ also had them with MACROs, why do you think they decided to now have them has built in feature?

How is sumtype buggy?

October 28, 2022

On Friday, 28 October 2022 at 14:47:27 UTC, ryuukk_ wrote:

>

On Friday, 28 October 2022 at 14:43:54 UTC, Nick Treleaven wrote:

>

Has C or C++ actually added sum types to their standards?

It was proposed and feedback was favorable, it's only just a matter of when now

Really? Who is championing the effort? Because if you do not keep working on it I can tell you out of experience (following WG21 lists since 2008 or so, from the top of my head) that it will vanish if noone keeps going forward.

October 28, 2022

On Friday, 28 October 2022 at 15:29:15 UTC, ryuukk_ wrote:

>

On Friday, 28 October 2022 at 14:49:28 UTC, Nick Treleaven wrote:

>

On Friday, 28 October 2022 at 14:47:27 UTC, ryuukk_ wrote:

>

On Friday, 28 October 2022 at 14:43:54 UTC, Nick Treleaven wrote:

>

Has C or C++ actually added sum types to their standards?

It was proposed and feedback was favorable, it's only just a matter of when now

Do you have a link? I saw the circle compiler extension and feedback wasn't all favourable. Standardising something is long and arduous.

Here is the latest revision i could find

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1371r3.pdf

And Bjarne Stroustrup thoughts

https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2021/p2411r0.pdf

>

Final words

>

I am still of the opinion that after a general model of concurrency, a module version of the standard
library, and library support for coroutines, pattern matching is the most promising addition to the
language for the (relatively) near future [P2000].

This is just the pattern matching part I am guessing. I do not see any built-in sum type there such as Rust's enum or Haskell/Ocalm style stuff for sum types. There is the std::variant library type so far.

1 2 3 4 5 6 7 8 9 10 11
Next ›   Last »