Navigation Menu

Skip to content

Commit

Permalink
attempt to produce more awesme error message when you do map { hash =…
Browse files Browse the repository at this point in the history
…> 1}
  • Loading branch information
moritz committed Aug 2, 2010
1 parent f8b73df commit 65eb876
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/Any-list.pm
Expand Up @@ -34,6 +34,13 @@ augment class Any {

our multi method map(&block) { self.list.map(&block); }

our multi method map(%block) {
die "Can't call map() with a Hash argument, Callable required\n"
~ "You probably wrote a Hash composer accidentally - try to\n"
~ "disambiguate the it with a ; directly after the opening brace";

This comment has been minimized.

Copy link
@madsen

madsen Aug 2, 2010

Contributor

You have an extra 'the" in this message. I think you meant "disambiguate it".


}

our multi method sort(&by = &infix:<cmp>) { self.list.sort(&by); }

method rotate($n = 1) { self.list.rotate($n); }
Expand Down Expand Up @@ -355,7 +362,7 @@ proto sub max($by, *@values) { @values.max($by); }
proto sub minmax($by, *@values) { @values.minmax($by); }
proto sub uniq(@values) { @values.uniq; }
proto sub pick ($num, :$replace, *@values) { @values.pick($num, :$replace); }
proto sub map(&mapper, *@values) { @values.map(&mapper); }
proto sub map($mapper, *@values) { @values.map($mapper); }
proto sub kv(@array) { @array.kv; }
proto sub keys(@array) { @array.keys; }
proto sub values(@array) { @array.values; }
Expand Down

0 comments on commit 65eb876

Please sign in to comment.