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

Re: PPC Elevator Pitch for Perl::Types

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
August 19, 2023 08:44
Subject:
Re: PPC Elevator Pitch for Perl::Types
Message ID:
CAHhgV8g3GecT+2sggq3dGrkftwjHewF-TcW7rcXPOnfMSJ_iyg@mail.gmail.com
On Sat, Aug 19, 2023 at 9:40 AM Dave Mitchell <davem@iabyn.com> wrote:

> On Sat, Aug 19, 2023 at 02:56:13AM +0000, Oodler 577 via perl5-porters
> wrote:
> > Does that help answer your initial questions?
>
> 'fraid not :-)
>
> If I am understanding correctly, Perl::Types is intended to be something
> which can be used stand-alone, independent of RPerl, and which you want to
> be bundled with the perl core.
>
> Within that context, how does adding 'use Perl::Types' at the top of a
> perl (not RPerl) program do its thing? What mechanism are you using that
> causes this line in a non-RPerl program to croak;
>
>     my number $x;
>     ...
>     $x = 'foo';  # croak
>
> e.g. is it a source filter, set magic attached to $x, or ...?
>
> Also, from your reply about my mutator example not croaking by default,
> this seems to imply that it's quite possible for $x to obtain a
> non-numeric value under some circumstances. So, by default, what
> circumstances will croak and which will silently allow $x to become
> something other than a number? E.g. which of these lines croaks?
>
>     $x = 'foo';
>     $x =~ s/1/a/;
>     substr($x,0,1) = 'foo';
>     my $y = substr($x,0,1);
>
> Just in general terms I'm still confused as to what effect adding
> 'Perl::Types' to my program will have, and how it achieves that effect.
>

You're assuming that Perl::Types isn't all vaporware and this is a proposal
by people who know what they're doing. It all becomes much clearer when you
let go of those assumptions.

Leon

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