On Tue, Jul 29, 2014 at 05:54:24PM -0400, Ricardo Signes 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. > > 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. > > Something roughly like "safe <<>> operator meaningless on concrete filehandles" That may be hard, as this: while (<<ARGV>>3) {print} ARGV is legal syntax. You'd need to look ahead a couple of tokens to determine whether '<<ARGV>>' is reading from a filehandle, or shifting a here doc. AbigailThread Previous | Thread Next