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:
Smylers
Date:
July 27, 2014 09:04
Subject:
Re: New feature proposal : <<>> to disable magic open of ARGV
Message ID:
20140727090356.GH2791@stripey.com
Rafael Garcia-Suarez writes:

> On 27 July 2014 01:16, Ricardo Signes <perl.p5p@rjbs.manxome.org> wrote:
> 
> > To me, the most significant concern is probably the one about
> > improving our defaults.  I'm not sure I think this is the best
> > solution, but let me know if you think it's clearly better or worse,
> > or if it suggests anything else to you:
> >
> > * use feature 'magic_open_argv'
> > * ...which goes into the default feature bundle, and old versions
> > * ...but not the new version's bundle, so it's off by default on use 5.22
> > * ...and it's on in the while() code generated by -n
> > * ...but we have -N and -P
> 
> Why the double negation?

This way, the only double negative is in Rik's description of the plan.
From a Perl programmer's point of view, it's simply that somebody
wanting to use the feature use-s it.

> use feature 'nomagic_open_argv' should work similarly.

But that imposes the double negative on users. In that if in perl 5.22
nomagic_open_argv is the default, somebody wanting the magic behaviour
would have to do:

  no feature qw<nomagic_open_argv>;

That's unquestionably a double negative, and is far harder to grok than:

  use feature qw<magic_open_argv>;

It also prevents bundling all the features you want into a single call.
Instead of:

  use feature qw<say magic_open_argv unicode_strings signatures>;

You'd have to write:

  use feature qw<say unicode_strings signatures>;
  no feature qw<nomagic_open_argv>;

It'd be a weird exception that most features are enabled positively but
one of them is enabled by disabling its opposite — an exception that's
only explained by historical reasons.

So I think nomagic_open_argv is much worse from the point of view of not
avoiding banishing double negatives ...

Smylers
-- 
Girls don't wear their shoes out, and boys don't care about style?
  Clarks think so: http://j.mp/clarksgirlboyposters
Disagree? Don't want shops promoting gender stereotypes to children?
  Please sign the petition: http://j.mp/clarksgirlboypetition

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