On Fri, 15 Jan 2016 10:24:16 -0800, c...@zoffix.com wrote: > The slip (|) before a range has higher precedence and it interprets > the starting point of the range as a single-item list. This leads to > two types of bugs, and both situations should likely be error > messages: > > 1) Infinite loop when range contains letters, as the range starts from > 1 and tries to reach the second letter by increasing a number: > > <ZoffixW> m: .say for |"g".."z"; > <camelia> rakudo-moar 3259ba: > OUTPUT«(timeout)1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515…» > > 2) Incorrect range is produced when numbers are used for the range. > It'll always start at 1 and proceed until the end number: > <ZoffixW> m: .say for |10..20 > <camelia> rakudo-moar 3259ba: > OUTPUT«1234567891011121314151617181920» > <ZoffixW> m: .say for |10..5 > <camelia> rakudo-moar 3259ba: OUTPUT«12345» > > Relevant IRC conversation: http://irclog.perlgeek.de/perl6/2016-01- > 15#i_11894289
I submitted: https://github.com/rakudo/rakudo/pull/1182 ...which warns on these: $ perl6 -e 'say |4..5' Potential difficulties: To apply a Slip flattener to a range, parenthesize the whole range. (Or parenthesize the whole endpoint expression, if you meant that.) at -e:1 ------> say ⏏|4..5 1..5 $ perl6 -e 'say ~4..5' Potential difficulties: To stringify a range, parenthesize the whole range. (Or parenthesize the whole endpoint expression, if you meant that.) at -e:1 ------> say ⏏~4..5 "4"..5 $ perl6 -e 'say |4 R.. 5' Potential difficulties: To apply a Slip flattener to a range, parenthesize the whole range. (Or parenthesize the whole endpoint expression, if you meant that.) at -e:1 ------> say ⏏|4 R.. 5 5..1 $ perl6 -e 'say ~4 R.. 5' Potential difficulties: To stringify a range, parenthesize the whole range. (Or parenthesize the whole endpoint expression, if you meant that.) at -e:1 ------> say ⏏~4 R.. 5 5..4 (don't know why that last one "works", but still worth warning.) It also handles all the ^..^ variants.