Standard way to supply hints to branches

Daniel N no at public.email
Sat Sep 14 09:13:56 UTC 2024


On Saturday, 14 September 2024 at 08:32:53 UTC, Johan wrote:
> On Thursday, 12 September 2024 at 22:59:32 UTC, Manu wrote:
>>
>> expect() statements are not a good time.
>
> Why not?
> Expect is known from other languages and is more general (can 
> work with wider range of values than just true/false, and can 
> work with types too), and reduces the problem to the backend 
> domain only: no new parsing rules (don't forget editors and 
> other tooling), and no AST change, etc.
>

Statements are not DRY but expressions would be.

```d
void dry(int i)
{
   if(expect!false(i < 0))
     return;
```


More information about the Digitalmars-d mailing list