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

RE: Pre-RFC: Real "boolean" SV type

Thread Previous | Thread Next
From:
Carl Friedberg
Date:
August 4, 2021 15:22
Subject:
RE: Pre-RFC: Real "boolean" SV type
Message ID:
BL3PR04MB8169677FB0C50694D531BB0BC3F19@BL3PR04MB8169.namprd04.prod.outlook.com
Hi Paul LeoNerd,

Yes, please write the RFC. Thank you,

Carl Friedberg
President, Comet &Company
165 William St New York NY
Office  (212) 233-5470
Cell      (917) 861-7819

-----Original Message-----
From: Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> 
Sent: Wednesday, August 4, 2021 10:58 AM
To: Perl5 Porters <perl5-porters@perl.org>
Subject: Pre-RFC: Real "boolean" SV type

I propose the addition of a new SV type, of SVt_BOOL. Should I write an RFC?

This type will act much like the existing "booleans" of PL_sv_no and PL_sv_yes, except its type will remain distinct, so it will be possible to distinguish "that SV is a boolean". This is a requirement for certain kinds of data serialisation - such as JSON or MsgPack - and may be useful for many other purposes too.

Still to be determined: a pureperl interface on it. E.g. would this be
possible:

  use feature 'bool';

  my $yes = true;   # new literal value keywords
  my $no  = false;  #

  use Scalar::Util 'svtype';

  is( svtype($yes), "BOOL", 'true is SVt_BOOL');

Thoughts on a postcard*.


*: Where "postcard" means: **PLEASE KEEP REPLIES SHORT**. This is a pre-RFC question. Replies should be limited to the question of whether I should write the RFC - not about the feature itself.

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

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