C++ pattern matching is coming
Timon Gehr
timon.gehr at gmx.ch
Sun Oct 23 23:54:06 UTC 2022
On 10/24/22 01:42, Walter Bright wrote:
> On 10/23/2022 4:02 PM, Timon Gehr wrote:
>> I don't expect it to be "finalized" very soon. It lacks
>> expressiveness, which will be improved by small, incremental changes.
>
> The changes have been bug fixes. The concept has held up well.
>
As soon as people try to use it in production they will run into some
issues with expressiveness. For example, DIP1000 does not even support
storing objects with different lifetimes in different fields of the same
struct. (Real case that came up on Discord today.)
The underlying issue is that DIP1000 lacks a modular way to track
different lifetimes. E.g., DIP100 does not allow having an array
allocated on a region allocator, containing references pointing to
objects allocated on a distinct region allocator with correct lifetime
tracking. As soon as you store things in the array and want to get them
back out, if it works at all, their lifetimes will be limited by the
lifetime of the region allocator that backs the array storage, even if
their own allocator actually is longer-lived.
DIP1000 is very keen to conflate different lifetimes and to cut the
longer one off based on the shorter one.
More information about the Digitalmars-d
mailing list