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

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

Thread Previous | Thread Next
From:
Aaron Priven
Date:
August 4, 2021 22:30
Subject:
Re: Pre-RFC: Real "boolean" SV type
Message ID:
5DC6470A-0A1B-4D6D-9BFF-9A3D44D3E456@priven.com
I don’t have a problem with the proposal per se, but it’s hard for me to believe that inferring what type a value should be from its initial assignment is going to be reliable.

Surely there’s a lot of extant code like

  if ($condition) {
     $flag = $x eq $y;
  } else {
     do_something();
     $flag = 1;
  }
  $count+= $flag;

Is $flag a boolean or an integer? 

I can appreciate the desire to have serializers work on data without having to pass type information separately, but it seems really unlikely to me that it’s possible to be consistent without being explicit.

-----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?

-- 
Aaron Priven, aaron@priven.com, www.priven.com/aaron


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