Re: Reördering SVt_* constants; "internal" SV type

[email protected] ("H.Merijn Brand" via perl5-porters) Tue, 30 Jun 2026 09:55:02 +0200
Newsgroups perl.perl5.porters
Message-ID <20260630095502.6b1a3606@pc09>
--Sig_/ezeewq=6h1XiJ/6_virEzhq
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Mon, 29 Jun 2026 23:00:58 +0100, "Paul \"LeoNerd\" Evans" <leonerd@leone=
rd.org.uk> wrote:

> On Thu, 18 Jun 2026 14:45:20 +0200
> "H.Merijn Brand" via perl5-porters <[email protected]> wrote:
>=20
> > I am scared it would break a lot of CPAN/XS =20
>=20
> Actually, having read them over I think a lot of your examples prove my
> exact point ;)

Thanks for the explanation. It now makes even more sense!

Glad my examples triggered that

> For example:
>=20
> > DBI.xs:    if (!SvROK(ref) || SvTYPE(SvRV(ref)) > SVt_PVMG) /* XXX LV *=
/ =20
>=20
> Yup. This line here is attempting to check that `ref` is definitely a
> reference to a perl scalar; so it's going to reject anything that isn't
> ROK or anything whose RV's SvTYPE is greater than SVt_PVMG. But it
> therefore misses the SVt_PVLV case. In fact its author is even aware of
> this, having written  /* XXX LV */  in the comment there (unless they
> did mean to write the Roman numbers 30, 53. But I doubt it ;) )
>=20
> Having skim-read most of the rest of the other examples, I think every
> single one of them is going to fall foul of the exact issue I am trying
> to address here. Namely, that they will have a false positive and
> believe that an SVt_INVLIST is a perl scalar (when in fact it is not),
> and a false negative and believe that an SVt_PVLV is not a perl scalar
> (when in fact it is and should be treated as such).
>=20
> I do not believe that the simple adjustment of moving SVt_INVLIST out
> of that range and moving SVt_PVLV up next to SVt_PVMG is going to
> change the behaviour of any of these previous comparisons which were
> already correct, because if they were correct before they'll still be
> correct afterwards. However, I think it will stand a good chance of
> suddenly making coincidentally correct a lot of code that previously
> missed those two edge cases.

--=20
H.Merijn Brand  https://tux.nl   Perl Monger   http://amsterdam.pm.org/
using perl5.00307 .. 5.37        porting perl5 on HP-UX, AIX, and Linux
https://tux.nl/email.html http://qa.perl.org https://www.test-smoke.org
                          =20

--Sig_/ezeewq=6h1XiJ/6_virEzhq
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEGolmczWuFi3lJEbAA6FHoT5dwJgFAmpDdlYACgkQA6FHoT5d
wJirxwf/ZfCYyV26tLriFom3xZI0On86KgD1J+8+DdGROfph7KHkvYz5RyUGQdZ5
5vZ1Us+lILCtCvaiKu+O8bzrFI23qB+uDpVCDKftxSs3T6e6Hkcf4a5P75XXVCcS
dH+HMsNhkpEuWVebzCW8C2Cgd8WmHnPhf3xvKhSpHlsbQpQMo2o7qd4p329yUxIr
wHoYGq9pdrxaOlwahPi3pns6jTkHhOSMMGGwN0V8YrjHAr9OsCAh0/aWl9e2RWdE
cGoa+TE8+XDmN64gsOQD1reLs97Gdu8RmST9ac7NYOzxjWxyimJKAbsyhUo+Wxhd
YpwvlRRe8JpQeFEMsViVLdY++c1d5A==
=uX93
-----END PGP SIGNATURE-----

--Sig_/ezeewq=6h1XiJ/6_virEzhq--