Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make List.index|indiced|contains issue a warning
https://docs.raku.org/language/traps#Strings_are_not_Lists,_so_beware_indexing shows that it is a very common newbie error to use the "index", "contains" and "indices" methods on a List, not realizing that that will first stringify the List (because Lists are Cool). And this *not* give the result one expects, or in a worse case, provide false positives. say ("a","b").contains("ab") # True This commit adds 3 'List:D: Str:D \needle' candidates which should catch this type of newbie behaviour. Should this be intended behaviour, then the warning can be simply circumvented by adding ",0" (aka, starting from the first position in the string). Or by explicitely joining the List first. Please revert if this is somehow deemed unnecessary or unwelcome.
- Loading branch information
c9b0218
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much. ♥