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

[email protected] (Dagfinn Ilmari Mannsåker) Thu, 18 Jun 2026 12:52:45 +0100
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
"Paul \"LeoNerd\" Evans" <[email protected]> writes:

> (By the way, we currently have 56 different PRs marked
> "defer-next-dev", awaiting the 5.44 release, and I'm still in the
> process of making the problem worse. ;) Anyhow...)
>
> I have a few separate branches and items of work that all seem to be
> hitting upon a common problem. Namely, that I would like it if certain
> properties about SVs could be easily determined by a cheap number
> comparison on SvTYPE. In particular, I would really like it if we could
> write out comparisons in the following forms:
>
>   An SV should be treated as a Perl-visible scalar
>     if SvTYPE(sv) <= SVt_PVMG
>
>   An SV is a safe for Perl code to operate on
>     if SvTYPE(sv) <= some-other-value  (which would exclude a few weird
>                                        oddballs)

[...]

> While I'm at it, I'd ensure
> that this new SVt_INTERNAL type definitely lives at the very end of the
> list, keeping it out of numerical range tests on most of the other
> sensible properties.

This is a sensible goal, but I don't think the checks should actually be
written out as <= comparisons, that should be an implementation detail
hidden behind a macro or static inline function.

- ilmari