Re: Reördering SVt_* constants; "internal" SV type
[email protected] (Karl Williamson via perl5-porters) Thu, 18 Jun 2026 12:45:17 -0600
| Newsgroups | perl.perl5.porters |
|---|---|
| Message-ID | <[email protected]> |
On 6/18/26 06:07, Richard Leach wrote: > On Thu, 18 Jun 2026 at 12:45, Paul "LeoNerd" Evans > <[email protected]> wrote: >> An SV should be treated as a Perl-visible scalar >> if SvTYPE(sv) <= SVt_PVXX > > Yeah, this would be nice to have. > >> SVt_INVLIST is not a perl-visible scalar, in fact should not be >> visible to any perl code anywhere for any reason, but >> it sorts right after SVt_PV and before SVt_PVIV and is >> thus accidentally included in the above scalar test > > I think it's located there because it's sort of a PV under the hood. > Not sure offhand if moving it out of the "Perl-visible scalar" > grouping would break anything. I searched for the best place to insert it, and came up with that. I believe that there were pre-existing conditionals that used a < comparison that putting it further down would break. > >> I know there are some ordering constraints involved in the SvTYPE >> values, but I don't believe it would be too problematic to move >> SVt_PVLV to just after SVt_PVMG (and thus allow a contiguous range for >> scalars). > > Might need to adjust the handful of places that do "type <= SVt_PVLV" > and similar. > > Are there some code paths in which SVt_PVGV is also treated like a > "Perl-visible scalar" or at least would be nice to have it covered by > a "SvTYPE(sv) <= some-other-value" check?