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

Re: PSC #031 2021-07-30

Thread Previous | Thread Next
From:
Oodler 577 via perl5-porters
Date:
July 31, 2021 19:52
Subject:
Re: PSC #031 2021-07-30
Message ID:
20210731195229.GS28661@odin.sdf-eu.org
* 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

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