On Wed, Mar 16, 2005 at 05:31:17PM +0200, Markus Laire wrote: : What should index("Hello", "", 999) return in perl6? : : In perl5 that returns 5, but IMHO -1 would be right result.
Well, neither of those is the right result, since index is probably not going to be returning integers in Perl 6, but string positions which might have different integer values depending on whether you look at them as bytes, codepoints, graphemes, etc. And the string position value will be true for valid string positions and false/undef otherwise. When you call index, it's going to assume that 999 is to be converted to a string position under the current Unicode pragma, which turns out to be undefined on the string in question, so your call above probably either warns or throws an exception because you tried to use an undefined value to do something defined. Larry