Herb Sutter's CppCon talk "Extending and Simplifying C++: Thoughts on Pattern Matching using `is` and `as`"

Timon Gehr timon.gehr at gmx.ch
Tue Nov 2 07:24:39 UTC 2021


On 01.11.21 23:02, Andrei Alexandrescu wrote:
> 
>> 4. The way scope & return & ref apply to types is completely 
>> consistent. This enables me to advise that when people have problems 
>> understanding it, to rewrite their example code in terms of raw 
>> pointers, as it will behave the same.
> 
> I very much wish this is true and useful.

I think DIP 1000 etc. is actually a prime example of non-orthogonal 
language design, even if we ignore the issues with `ref` that have 
already been brought up. Lifetimes are not orthogonal to aggregates and 
function calls. To avoid such a situation, Rust allows explicit lifetime 
parameters.

In general, if for type checking, the compiler tracks information that 
can't be passed along when calling functions or when storing data in a 
struct/class, there will inevitably be trouble.

I have been guilty of implementing quick hacks like that myself in order 
to get code to type check before the paper deadline, but this kind of 
thing always comes back to bite users and ultimately the language 
designer. [1]

[1] https://github.com/eth-sri/silq/issues/28


More information about the Digitalmars-d mailing list