Suggestion: Operator `in` for slices

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Dec 20 13:50:16 UTC 2021


On Monday, 20 December 2021 at 10:34:44 UTC, Dennis wrote:
> In my proposal `'a' in ['a', 'b']` will return `null` because 
> it looks for the key 'a', and since the ASCII value of 'a' is 
> `0x61` and the array length 2, it will return `null`.

Oh yeah, I'm sorry, you looked at the index as a key. I'm not 
sure how I managed to mix that up…

But yeah, just doing what Python does, but with a pointer to a 
value or null instead of boolean, makes sense in D.






More information about the Digitalmars-d mailing list