develooper Front page | perl.perl5.porters | Postings from July 2011

__FILE__ prototype

Thread Next
July 19, 2011 13:49
__FILE__ prototype
Message ID:
Just spotted this in perldelta:

    The C<prototype> function now returns a prototype (the empty string) for
    the C<__FILE__>, C<__LINE__> and C<__PACKAGE__> directives, instead of
    dying, as they are indistinguishable syntactically from nullary functions
    like C<time>.


    $ perl -lwe 'print time()'
    $ perl -lwe 'print __FILE__()'
    syntax error at -e line 1, near "__FILE__("
    Execution of -e aborted due to compilation errors.

I'm all for treating them as nullary functions, but that's not currently
what they look like.  I think we can readily resolve this by allowing
empty parens after __FILE__ et al; as shown here, it's currently a syntax
error, so it won't break anything.  (But tread carefully when editing
this stuff.  It is subtle and quick to anger.)


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About