Closed
Description
Description
A comment block towards the top of sv.h says:
...
C<SVt_NULL> can only hold undef. C<SVt_IV> can hold undef, an integer, or a
reference. (C<SVt_RV> is an alias for C<SVt_IV>, which exists for backward
compatibility.) C<SVt_NV> can hold any of those or a double. C<SVt_PV> can only
hold C<undef> or a string. C<SVt_PVIV> is a superset of C<SVt_PV> and C<SVt_IV>.
C<SVt_PVNV> is similar. C<SVt_PVMG> can hold anything C<SVt_PVNV> can hold, but it
can, but does not have to, be blessed or magical.
Two things seems amiss when reading that:
- PVs can hold
undef
, a string, or a reference. It seems like a simple comment update is needed here? - It reads like an NV can hold undef, an integer, a reference, or a double. However,
Perl_sv_setsv_flags
seems to only account for it holding either undef or a double.
e.g. perl -MDevel::Peek -e 'my $y = 3.3; $y = {}; Dump($y)'
reveals that $y
is upgraded to a PVNV to store the reference, but if NV's can store references, surely no upgrade should be required?
So I'm unclear here whether the comment block needs updating to match the realities of the implementation, or the implementation needs updating so that NVs actually can store integers and references.
Perl configuration
Applies to blead and at least the past few stable releases.
Metadata
Metadata
Assignees
Labels
No labels