Null-checked reference types

Quirin Schroll qs.il.paperinik at gmail.com
Tue Aug 6 17:14:59 UTC 2024


On Tuesday, 6 August 2024 at 15:21:58 UTC, Tim wrote:
> On Tuesday, 6 August 2024 at 14:55:46 UTC, Quirin Schroll wrote:
>> Add the following type suffixes to the language: `?` and `!`.
>
> Using `!` seems to be ambiguous with templates. For example:
> ```
> void f(T!x)
> {}
> ```
> Is `T!x` a template instance with template argument `x` or the 
> new type `T!` and parameter name `x`?

I totally missed that. It would definitely be parsed as a 
template instance in that case for backward compatibility. With 
Primary Type Syntax, you could write `(T!)` and it’s clear. With 
the proposed changes, you could be cheeky and write `T?!` because 
`T?` can’t be a template to be instantiated. But… I don’t like 
any of these.


More information about the dip.development mailing list