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

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

Thread Previous | Thread Next
Rafael Garcia-Suarez
July 30, 2014 15:13
Re: New feature proposal : <<>> to disable magic open of ARGV
Message ID:
On 29 July 2014 23:54, Ricardo Signes <> wrote:
> * Rafael Garcia-Suarez <> [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.
> I'm still not crazy about the one-off syntax addition, but I think that it's
> the best we're going to see without setting an unrealistic bar for a new,
> generic feature.  If we ever *do* get <> adverbs, we can call this sugar for
> one or blah blah blah it doesn't matter that much right now. :-)
> While my heart wants -n to be safe, my conscience tells me that we'll break
> enough (bizarre, to my mind (except maybe regarding "-")) expectations that it
> isn't worth doing.  Probably we want -P and -N for safe opening.
> I am gratified to see that <<X>> fails for any X, as you've only made the
> literal construct <<>> iterate.  Awesome.  I think we're going to want a better
> error message, if possible, though, than:
>   ~/code/perl5$ ./perl -e 'while (<<ARGV>>) { print }' 'ls |'
>   Can't find string terminator "ARGV" anywhere before EOF at -e line 1.

As Abigail pointed out that might be a bit difficult to implement.
Unless we write it «» instead :)

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