Mailing List Archive

PSC #031 2021-07-30
Present: Paul, Rik. Neil was on vacation.

## Outstanding Issues

No outstanding actions from last week - the `G_LIST` PRs are now all
done.

## Digression

We had a 5-minute digression from the agenda that strayed onto Raku's
colon-syntax for adverbs, and the observation that in Perl the
following is still a syntax error:

func( :name(1) );

Perl could maybe use that, or do something nicer, if we started making
a distinction about colons and significant whitespace before/after to
work out whether something is a label or not. And wouldn't it be nice
to have a real AST and not rely on hacks like PLS or PPI/PPR... More on
that another day perhaps.

## Review of perlexperiment

We skipped over the ongoing review of the Quirks document, because Neil
was absent.

We instead looked over the review of perlexperiment, decided to
slightly clarify what "experimental" even means, and used that to try
to classify the currently-running experiments into broad categories. We
quoted the definition from perlpolicy, which states:

If something in the Perl core is marked as experimental, we may
change its behaviour, deprecate or remove it without notice.

Experimental features will only have their experimental status
revoked when they no longer have any design-changing bugs open
against them ...

which suggests that "experimental" is mostly about the design shape,
and not the implementation itself. It's also about how much feedback
we've received about them. With this in mind the current classification
looks like:

Consider whether they're "done":
* isa
* :const subs

Design still ongoing:
* try/catch

Insufficient uptake for an answer to be obvious:
* unicode private character hooks
* unicode property wildcards
* variable-length lookbehind
* bracketed extended charclass

Probably needs changes before landing:
* signatures
* regex strictures (this should be moved to strict.pm - see
below)
* refaliases
* declared refs

Kill it with fire:
* smartmatch

"Is this experimental?":
* installhtml
* pluggable keyword API

On this last one, the pluggable keyword API, Paul suggests instead core
should gain a better abstraction mechanism, perhaps XS::Parse::Keyword
or something similar, to act as a decoupling mechanism between core
internals and keyword module authors. That would remove much of the
current reasoning why pluggable keywords remain "experimental".

## More strictures

We looked at trying to resolve the logjam that is the fact that
`strict.pm` implies just three strictness flags (vars, refs, subs) and
we seem unable to add more. The shape we came up with is that it would
be nice if `strict.pm` had versioned bundles, like `feature.pm` does,
and that an undecorated `use strict` really meant

use strict ':5.8';

Furthermore, much like the version bundles you get from `use vX`
turning into `use feature ':X`, the same should be done with `strict`
(and `warnings` while we're at it). This would give us the freedom to
one day add more strictness flags - like `use strict 're'` or anything
else that might come along.

Rik predicts: Somebody’s gonna say “but I want my CPAN-published code
to use warnings ':latest'”. What do we say? Either we add it or we let
somebody implement it on their own because $^V exists.

People can always write:

use warnings ":$^V";

This still leaves the open question of what does `use strict ':all'`
really mean. Rik: “use strict ‘:all’;” means “use strict ‘:5.8’” but
“no strict ‘:all’” means all for real. Paul: But authors should have
known it was always a ticking time-bomb in their code anyway, right? ;)

## use v5.36 to imply use utf8

Rik wants `use v5.38` to enable `use utf8`, and will post a message on
perl5-porters@. [he's already done so].

## Retroactive non-experiments

The idea is that, for example, `use v5.20` introduced experimental
postderef. Later, it became not only non-experimental, but even on by
default. It never changed behavior from v5.20.0 until then. It should
be possible to turn it on in v5.20 without `use experimental` but
instead something like `use feature v5.24 'postderef';` which would
imply "I want to use a feature that was experimental now, but became
stable without changing since now."

We discussed various ways this might be done, but all seemed to rely on
shipping some sort of dual-life module out of core onto CPAN, so older
perls can import it. This could be called `futuristic.pm` which would
be "experimental, but only safe things for your $^V" but "use feature"
eliminates one more name and some code..

Or maybe we could find a way to work it into `feature.pm` itself. The
$VERSION of feature now matters more because it's how people declare
the version of feature.pm which would enable the feature but disable
the warning. Tying that to perl version would be nice, and maybe easy.


--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: PSC #031 2021-07-30 [ In reply to ]
On Fri, Jul 30, 2021 at 12:24 PM Paul "LeoNerd" Evans <
leonerd@leonerd.org.uk> wrote

> ## More strictures
>
> We looked at trying to resolve the logjam that is the fact that
> `strict.pm` implies just three strictness flags (vars, refs, subs) and
> we seem unable to add more. The shape we came up with is that it would
> be nice if `strict.pm` had versioned bundles, like `feature.pm` does,
> and that an undecorated `use strict` really meant
>
> use strict ':5.8';
>
> Furthermore, much like the version bundles you get from `use vX`
> turning into `use feature ':X`, the same should be done with `strict`
> (and `warnings` while we're at it). This would give us the freedom to
> one day add more strictness flags - like `use strict 're'` or anything
> else that might come along.
>
> Rik predicts: Somebody’s gonna say “but I want my CPAN-published code
> to use warnings ':latest'”. What do we say? Either we add it or we let
> somebody implement it on their own because $^V exists.
>
> People can always write:
>
> use warnings ":$^V";
>
> This still leaves the open question of what does `use strict ':all'`
> really mean. Rik: “use strict ‘:all’;” means “use strict ‘:5.8’” but
> “no strict ‘:all’” means all for real. Paul: But authors should have
> known it was always a ticking time-bomb in their code anyway, right? ;)
>

This last part is easy. "use strict ':all'" doesn't currently exist, so it
can continue not existing.

Versioned strict bundles could be useful to add. I expect regardless of the
direct mechanism, ultimately the most impactful thing to affect would be
what "use VERSION" does in future versions. So maybe it's not necessary to
complicate strict.pm.

But I continue to disagree with the idea of versioned warnings. "use
warnings" is *supposed* to get you new warnings every Perl release, and
that is the explicitly documented warnings contract. Versioning them would
be counterproductive.

-Dan
Re: PSC #031 2021-07-30 [ In reply to ]
On Fri, 30 Jul 2021 12:54:08 -0400
Dan Book <grinnz@gmail.com> wrote:

> But I continue to disagree with the idea of versioned warnings. "use
> warnings" is *supposed* to get you new warnings every Perl release,
> and that is the explicitly documented warnings contract. Versioning
> them would be counterproductive.

That's fair - the discussion really was about 'strict', the fact we
threw in 'warnings' as well was mostly a 10-second offhand "oh might as
well do warnings too". We can revisit that separately.

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: PSC #031 2021-07-30 [ In reply to ]
* Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> [2021-07-30 17:24:25 +0100]:
>
> Kill it with fire:
> * smartmatch
>

Might want to start with cleaning up the POD in https://metacpan.org/pod/experimental,
which has smartmatch ALL over it. In fact, it's so heavily smatmatch centric that simply
deleting the mention of it begs for a fully new document.

Cheers,
Brett

>
>
> --
> Paul "LeoNerd" Evans
>
> leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
> http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
>

--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native
Re: PSC #031 2021-07-30 [ In reply to ]
On Fri, Jul 30, 2021 at 9:31 PM Oodler 577 via perl5-porters <
perl5-porters@perl.org> wrote:

> Might want to start with cleaning up the POD in
> https://metacpan.org/pod/experimental,
> which has smartmatch ALL over it. In fact, it's so heavily smatmatch
> centric that simply
> deleting the mention of it begs for a fully new document.
>

Patches welcome! :-)
Re: PSC #031 2021-07-30 [ In reply to ]
* Leon Timmermans <fawaka@gmail.com> [2021-07-30 22:33:31 +0200]:

> On Fri, Jul 30, 2021 at 9:31 PM Oodler 577 via perl5-porters <
> perl5-porters@perl.org> wrote:
>
> > Might want to start with cleaning up the POD in
> > https://metacpan.org/pod/experimental,
> > which has smartmatch ALL over it. In fact, it's so heavily smatmatch
> > centric that simply
> > deleting the mention of it begs for a fully new document.
> >
>
> Patches welcome! :-)

Fair enough. Any suggestions on the features to highlight
in the examples?

Cheers,
Brett

--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native
Re: PSC #031 2021-07-30 [ In reply to ]
2021-7-31 1:24 Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote:

>
> Perl could maybe use that, or do something nicer, if we started making
> a distinction about colons and significant whitespace before/after to
> work out whether something is a label or not. And wouldn't it be nice
> to have a real AST and not rely on hacks like PLS or PPI/PPR... More on
> that another day perhaps.
> om/stores/leonerd/ <https://www.tindie.com/stores/leonerd/>


I think one reason Perl can't do static analysis is that the interpretation
of the parentheses of a function depends on the loading of other modules.

And another reason is there is a source filter.

Is there a realistic way to get the AST with static analysis?
Re: PSC #031 2021-07-30 [ In reply to ]
On Sat, 31 Jul 2021 14:45:10 +0900
Yuki Kimoto <kimoto.yuki@gmail.com> wrote:

> I think one reason Perl can't do static analysis is that the
> interpretation of the parentheses of a function depends on the
> loading of other modules.
>
> And another reason is there is a source filter.

The primary reason Perl can't do static analysis is that Perl isn't a
static language. It's a dynamic language ;)

> Is there a realistic way to get the AST with static analysis?

There's nice ways to get ASTs, yes. They will be of limited use for
"static analysis" because - see above - Perl is not a static language.

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: PSC #031 2021-07-30 [ In reply to ]
* Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> [2021-07-31 10:27:28 +0100]:

> On Sat, 31 Jul 2021 14:45:10 +0900
> Yuki Kimoto <kimoto.yuki@gmail.com> wrote:
>
> > I think one reason Perl can't do static analysis is that the
> > interpretation of the parentheses of a function depends on the
> > loading of other modules.
> >
> > And another reason is there is a source filter.
>
> The primary reason Perl can't do static analysis is that Perl isn't a
> static language. It's a dynamic language ;)

Perl::Critic is "static analysis"; it only gets you so far. SA only
implies what can be determined without actually running the code.

>
> > Is there a realistic way to get the AST with static analysis?
>
> There's nice ways to get ASTs, yes. They will be of limited use for
> "static analysis" because - see above - Perl is not a static language.

The language is dynamic, but the source is static text. It's over this
that "static analyis" is performed.

PPI or something in B::* would likely give you what you're wanting.

Note, there are interesting things ou there if you look, e.g., there
is a try/catch implemented out there using source filters and PPI:

https://metacpan.org/pod/Nice::Try

Cheers,
Brett

>
> --
> Paul "LeoNerd" Evans
>
> leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
> http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/

--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native