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

Re: New feature proposal : <<>> to disable magic open of ARGV

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
July 24, 2014 20:06
Subject:
Re: New feature proposal : <<>> to disable magic open of ARGV
Message ID:
CAMoYMM8Z8MjsJ2yqcApBEYGLFb2KJ+XFDOtSpd6gahonC-dPEw@mail.gmail.com
On 24 July 2014 19:13, Ricardo Signes <perl.p5p@rjbs.manxome.org> wrote:
> * Rafael Garcia-Suarez <rgs@consttype.org> [2014-07-24T11:51:40]
>> I believe that this was discussed here some years ago, and that this
>> was suggested by TomC. Anyway, I pushed a patch on rgs/nomagicopen.
>> The patch is incomplete as it lacks docs and tests. I welcome feedback
>> on the intent of the feature.
>
> Gut reaction after 30s while sitting in a conference session:
>
> I like the feature, but I think it might be too small a change to pick up a new
> operator.  What about a pragma/feature?

It's more syntactic sugar than new operator. That said, there are benefits
and drawback in the 2 approaches.

Con: The syntax is backward-compatible, so technically we don't *need* a new
pragma to enable it. <<>> optimises for less verbosity.

Pro: However on one-liners without a pragma we lack a way to transform the
implicit while(<>) of -n or -p into a while(<<>>).

Pro: A pragma could also disable the magic in eof() (the one with empty
parentheses).

So what would be a pragma name ? secure::open ? open::nomagic ?

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About