Suggestion: Operator `in` for slices

Paul Backus snarwin at
Mon Dec 20 22:29:56 UTC 2021

On Monday, 20 December 2021 at 21:11:28 UTC, Ola Fosheim Grøstad 
> On Monday, 20 December 2021 at 14:21:08 UTC, Paul Backus wrote:
>> ```d
>> import std.algorithm.searching;
>> if (["if", "while", "for"].canFind(keyword)) {
>>     // ...
>> }
>> ```
> You can always create a library construct, but then you should 
> also argue in favour of removing AAs and "in". You either do 
> it, or you don't. Why the half-measures?

There are a lot of features one could potentially add to D to 
improve it, and limited resources to devote to doing so. I'm not 
necessarily *against* adding `in` for slices, but since we 
already have a perfectly good library solution, I don't think it 
deserves a high priority.

Feel free to write the DIP yourself if you disagree. :)

More information about the Digitalmars-d mailing list