You certainly have a good point from a parsing
perspective, and this is likely where most of the implementation
issues arise. Still, this limitation is really not all
that different from the way Perl treats $AUTOLOAD type
function calls. You
have to be careful to adjoin the function name with brackets,
because the compiler isn't astute enough to find the function
reference, instead assuming there is a bare word
in your code, and whining accordingly. Here's how
the compiler appears to behave when finding functions to
AUTOLOAD:
Func($x) -> &Func($x) OK
Func ($x) -> 'Func' ($x) !?!?
So, presumably, the same thing would apply to the parsing
of curly braces, in theory:
foo $bar{$baz} -> &foo($bar{$baz})
foo $bar {$baz} -> &foo($bar,sub {$baz})
I discovered this trying to eliminate the requirement for
'my ($self) = @_' having to be in every function for an
OO program by writing a wrapper which did it for you.
For whatever reason, you can't operate on a named sub.
Oh well.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|