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

Re: PPC Elevator Pitch for Perl::Types

Thread Previous | Thread Next
From:
Chris Prather
Date:
August 21, 2023 11:18
Subject:
Re: PPC Elevator Pitch for Perl::Types
Message ID:
7A7A1101-C676-4020-B6D4-FF4CF2BEEB9B@prather.org


> On Aug 21, 2023, at 6:30 AM, Martijn Lievaart via perl5-porters <perl5-porters@perl.org> wrote:
> So basically you are implying #2 can work for classes (for Perl::Types), because classes use SVs in a certain predictable way. But for anything else, this will not work as exposing SVs will not do anything useful for the context we are looking at, correct?

Classes are a red-herring here, and kinda orthogonal. Specifically the APIs that things like Lexical::Types exposes simply don’t exist (as far as I could tell) for anything but scalars. It feels like we implemented just enough to make fields.pm work as a proof of concept and then moved on with our lives.

The reason that Perl::Types shouldn’t have any issue after this is that presumably once they know what type a variable is they can simply call SvIOK, SvNOK, or SvPOK …

Looking at RPerl, each type has a class associated with it so I would assume that there is some mechanism XS to perform the assertion that doesn’t use something like Variable::Magic. 

I mean if you can solve the annotation problem, worst case scenario is that you implement a system like https://metacpan.org/pod/Object::Pad::FieldAttr::Checked to do the assertion on set and use the various Sv*OKs.

-Chris


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