# New Ticket Created by Alex Jakimenko # Please include the string: [perl #126799] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=126799 >
Code: my @a[3]; say @a.reverse Result: Cannot reverse a fixed-dimension array in block <unit> at -e:1 It may be more complicated for multi-dimensional arrays, but reversing a 1-dimensional is rather straightforward. Therefore, it should probably throw a NYI warning. But then it gets weirder: my @a[3] = <5 10 15>; say reverse(@a) Result: [15 10 5] Whoops! Seems like in this case there is a difference between 「reverse」 sub and 「.reverse」 method. I am not sure it if should be like so, I've always thought that both should behave almost identically. Let's try the same thing with 「sort」: my @a[2;3] = (15,16,17), (4,5,6); say sort(@a) Since 「reverse」 sub worked, we could expect 「sort」 to work as well (but notice that there are two dimensions now!). Here is the result: Cannot access 2 dimension array with 1 indices in block <unit> at -e:1 Okay, that's LTA but it was somewhat expected. It is also how 「reverse」 works with multidimensional arrays. Anyway, let's try the method: my @a[2;3] = (15,16,17), (4,5,6); say @a.sort I am kinda expecting either NYI (if sorting a multidim array will ever make any sense) or “Cannot reverse a fixed-dimension array” error. Let's see. Result: (4 5 6 15 16 17) It is just too inconsistent, I think. Possible solution: 1) Same behavior for subs and methods 2) NYI warning for all operations on 1-dimensional arrays if not implemented. 3) “Cannot reverse a multidimensional array” and similar errors for all operations with arrays that have more than 1 dimension.