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

Re: PPC Elevator Pitch for Perl::Types

Thread Previous | Thread Next
Dave Mitchell
August 19, 2023 07:40
Re: PPC Elevator Pitch for Perl::Types
Message ID:
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.

A problem shared is a problem doubled.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About