develooper Front page | perl.perl5.porters | Postings from February 2022

Re: The explicit strict hints bits - Can we remove them?

Thread Previous | Thread Next
From:
Tom Molesworth via perl5-porters
Date:
February 3, 2022 23:36
Subject:
Re: The explicit strict hints bits - Can we remove them?
Message ID:
CAGXhHdka5M_AxN5KQh+RtwFnqdBjevZWsgrqFBO=u1ePNr4n2A@mail.gmail.com
On Fri, 4 Feb 2022 at 07:02, Dan Book <grinnz@gmail.com> wrote:

> On Thu, Feb 3, 2022 at 5:23 PM Paul "LeoNerd" Evans <
> leonerd@leonerd.org.uk> wrote:
>
>> Before I get onto my actual point, let me paint a picture that is a
>> convenient lie, told through rose-tinted spectacles. It is not
>> completely true, but imagine in some future version of perl where the
>> `use builtin` feature becomes stable:
>>
>
> Apologies for the curt response to this detailed explanation, but I
> definitely support trying to make this implementation more intuitive as
> long as it can be done without breaking compatibility of common paradigms
> (such as interaction with importers like Moose, or using strict and
> warnings explicitly after use VERSION even though it may enable them). The
> one thing that would be worse than the current situation is if code
> silently had less strictures/warnings enabled than before, or enabled
> additional strictures than intended in production.
>

The concept seems reasonable, just not too clear on exactly what's being
suggested - would this affect these two cases, for example?

{ # Only using some of the features, e.g. variables should be declared, but
keep barewords and symbolic references enabled
 use strict 'vars';
 our $x = example; # should be fine
 $y = 'compile-time error'; # should fail
}

and

use strict;
{ # limited-scope disabling of a feature
 no strict 'refs';
 our $typo;
 my $name = 'whatever';
 *$name = sub { # this part is fine
  ++$tpyo # would want a compile-time error here
 };
}

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