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

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

Thread Previous | Thread Next
David Cantrell
October 28, 2021 11:54
Re: PSC #040(?) - Perl SV Flags special
Message ID:
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:

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About