develooper Front page | perl.perl5.porters | Postings from October 2021

Re: PSC #040(?) - Perl SV Flags special

Thread Previous | Thread Next
From:
David Cantrell
Date:
October 28, 2021 11:54
Subject:
Re: PSC #040(?) - Perl SV Flags special
Message ID:
20211028114057.GA4773@bytemark.barnyard.co.uk
On Thu, Oct 14, 2021 at 11:18:42AM +0100, Paul LeoNerd Evans wrote:

> The suggested next steps here involve creating a long list of "test
> cases"; situations involving performing various kinds of operations on
> values/variables, and specifying what are the properties of results,
> and side-effects on variables within it. Likely many of these
> properties will take the form of "appears to be a string" or "appears
> to be a number" or similar.
> 
> These test cases would suggest the form of an `XS::APItest`-like `.t`
> file which can live in Perl core, containing all the tests. Most
> critically it would require defining a new API to ask questions of the
> form "appears to be (some sort of data shape)" about the SVs. For
> instance, while the recent "stable-bools" branch added `SvIsBOOL()`
> there aren't similar test functions for other value shapes like strings
> and numbers. So that would need thinking about somehow.

While I daren't suggest that I've got it right, this might be a good
place to start as it looks at all kinds of weird edge-cases:
  https://metacpan.org/release/DCANTRELL/Scalar-Type-0.1.2/source/t/all.t

although given the current limitations, those tests are aimed at
divining whether we can accurately represent a value as a number (or as
an int) as opposed to whether it was originally a number/int.

-- 
David Cantrell | Reality Engineer, Ministry of Information

  European immigration: making Britain great since AD43

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