p5h / p5summit-2019

Perl 5 Summit
0 stars 0 forks source link

fix SV flags #28

Open tonycoz opened 4 years ago

tonycoz commented 4 years ago

This is dumb:

tony@mars:.../git/perl$ perl -MDevel::Peek -e '$x = 1; Dump($x); "$x"; Dump($x)'
SV = IV(0x55ff4d06c068) at 0x55ff4d06c078
  REFCNT = 1
  FLAGS = (IOK,pIOK)
  IV = 1
SV = PVIV(0x55ff4d066580) at 0x55ff4d06c078
  REFCNT = 1
  FLAGS = (IOK,POK,pIOK,pPOK)
  IV = 1
  PV = 0x55ff4d05b080 "1"\0
  CUR = 1
  LEN = 10

The "$x" should only set pPOK, not POK.

tonycoz commented 4 years ago

This might help with some of the smartmatch corner cases too.

Unfortunately it might break serializers (and maybe smartmatches) that work with the current behaviour.

leonerd commented 4 years ago

Unfortunately it might break serializers (and maybe smartmatches) that work with the current behaviour.

An uncharitable answer to that could be on some level all such serializers are broken, because they cannot not be broken due to the nature of the problem they are trying to solve.

tonycoz commented 4 years ago

Yeah, that was largely me being a Devil's Advocate.

Leont commented 4 years ago

An uncharitable answer to that could be on some level all such serializers are broken, because they cannot not be broken due to the nature of the problem they are trying to solve.

Agreed. This will unbreak a lot more code than it will break.