in reply to Re: Re: & function prototypes and parens
in thread & function prototypes and parens

The problem is that perls many little idiosyncracies make it difficult to generalize the behaviour of all the built ins. print is another exaple of a keyword whose behaviour cannot be emulated by a user defined function. As are all of the keywords which return undef when passed to prototype.

As I said before prototypes are a hack. So not all of the special behaviour of map/grep is provided by the prototype. My guess is that this has to do with the issues related to providing complete map or print like behaviour to generalized subs. Too many rules are violated by these procedures for it to be worthwhile to support it except in very special cases. Consider that you didnt cover all the ways that map can be called:

print map { "foo $_" } @list; print map({"foo $_"} @list); print map "foo $_", @list; print map("foo $_", @list); print map(sub { "foo $_" },@list); # this doesnt do what you think....
The last one is an example of the troubles that come with map's handling. It parses as
print map { sub { "foo $_" } } @list;
which frankly would seem to be an odd interpretation for a user generated function. Luckily we are trained from the get go to treat map as an unusal keyword.

--- demerphq
my friends call me, usually because I'm late....