On Mon, Jun 21, 2010 at 09:47:37AM +0100, Smylers wrote: > Larry Wall writes: > > On Fri, Jun 18, 2010 at 11:21:52AM +0200, Jan Ingvoldstad wrote: > > : On Fri, Jun 18, 2010 at 11:15, Smylers <smyl...@stripey.com> wrote: > > : > > : > For the benefit of Perl 5 programmers used to string reverse it > > : > would be nice to have a warning if reverse is invoked with exactly > > : > one string argument (but not with an array which happens to > > : > contain a string as its only element). > > : > > : Such warnings can become quite awful as Perl 6 grows and matures. > > I was only thinking about that specific warning, not generally warnings > that might be of use to Perl 5 programmers. And I don't see how warning > about calling reverse on a scalar would be awful. > > It isn't something that makes sense to do (it's a no-op), and it isn't > just former Perl 5 programmers who might make that mistake; anybody who > does could be warned about it.
On the other hand, many of our other list-y methods also work on scalars (treating them as a list of 1 element -- essentially a no-op): .join, .sort, .any, .all, .rotate, .max, .min, .pick, .reduce, .values, etc. It might be inconsistent that .reverse on a scalar warns when the others do not. Personally, I'm fine with .reverse issuing a warning when it appears on a scalar, but doing so will be inconsistent with the pattern of the other list methods on scalars. Pm