develooper Front page | perl.perl5.porters | Postings from August 2023

Re: PPC Elevator Pitch for Perl::Types

Thread Previous | Thread Next
From:
Ovid
Date:
August 19, 2023 07:48
Subject:
Re: PPC Elevator Pitch for Perl::Types
Message ID:
CA+M4CHs-wJWMa+j2iXYVAsHPgBvzQn0kqYsA+Ce0fvjc1LtBMg@mail.gmail.com
On Sat, Aug 19, 2023 at 4:56 AM Oodler 577 via perl5-porters <
perl5-porters@perl.org> wrote:

> > In what circumstances are these type checks carried out / enforced? Is it
> > just on scalar and list assignment? Or more generally? For example, does
> > this croak?
>
> >     sub mutate { $_[0] = 'foo' }
> >     my number $x;
> >     mutate($x);
>
> The Perl compiler currently supports type enforcement for subroutine
> calls, so that is our starting point for Perl::Types.  Thus, your
> example above would not croak, because the subroutine does not
> specify any data types for its input arguments.  Type checking is
> simply disabled for subroutines without input argument types.
>

What was being asked was about the behavior of the @_ array. $_[0] is an
alias to $x. Assigning to $_[0] is the same as assigning to $x. Why does it
suddenly lose its knowledge of its type when its in the sub?


> The `TYPE_CHECKING` directive can have a value of `OFF` for disabled,
> `ON` to call the `foo_CHECK()` macros/functions, and `TRACE` to
> call the `foo_CHECKTRACE()` macros/functions.  The only difference
> between `ON` and `TRACE` is the inclusion of the offending subroutine
> and variable names for easier debugging.
>
> Does that help answer your initial questions?
>

That answers one of my questions about being able to disable them.  It
doesn't answer my question about whether or not this will work:

my $var1         = 234;my integer $var2 = 456; # Perl::Typesmy $total
      = $var1 + $var2;

You haven't answered my questions on github. You haven't answered them in
this thread. You haven't addressed Yves' concerns which were raised on
github, where he clearly explains *why* this proposal is not likely to work
(
https://github.com/orgs/Perl-Apollo/discussions/27#discussioncomment-6680632
).

Why are you not answering those questions?

-- 
Curtis "Ovid" Poe
--
CTO, All Around the World
World-class software development and consulting
https://allaroundtheworld.fr/

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