in reply to Re: coderefs and (&) prototypes
in thread coderefs and (&) prototypes
The real question is why doesn't it accept arbitrary expressions that return a code ref. And the answer is that there's no way to guarantee that the expression will return a code ref.and then
\&cb is guaranteed to return a code ref, so it's allowed for (&). By extension, this includes \&{ EXPR }.
I don't understand these two together. There's no way to guarantee that EXPR in \&{ EXPR } will evaluate to a code-ref either, and, if it doesn't, the extra \& noise isn't going to prevent it from blowing up at run-time—so why put the programmer through that extra syntactic hassle, if it doesn't buy him or her any extra safety?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: coderefs and (&) prototypes
by ikegami (Patriarch) on Jul 28, 2009 at 21:23 UTC |