develooper Front page | perl.perl6.users | Postings from April 2022

Re: checking MAIN arguments

Thread Previous
From:
Luca Ferrari
Date:
April 28, 2022 07:04
Subject:
Re: checking MAIN arguments
Message ID:
CAKoxK+7dNk29NwzTZGwNUoC8P=Ub-Y+ksGjZTR+Xt00WE=AkPw@mail.gmail.com
On Wed, Apr 27, 2022 at 7:29 PM yary <not.com@gmail.com> wrote:
> It's like the "where" clause has its own signature-like list of types it will accept. When the where clause uses the default topic "$_" then that topic has no constraint, and MAIN can probe if "--dir=something" should be interpreted as a flag Bool::True or if it should be the string "something". When the "where" clause has only $dir in the body, the optimizer can specialize it to only take Str, and then MAIN doesn't need to probe the Bool::True case.

Sounds a good guess!
What I am a little surprised here is that it seems to me this
behavior, that has changed during time, is not well documented, at
least according to me.

Luca

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About