perl11 / cperl

A perl5 with classes, types, compilable, company friendly, security
http://perl11.org/
Other
142 stars 17 forks source link

Keep SPECIAL immortals in arrays, esp. YES, NO #413

Open rurban opened 4 years ago

rurban commented 4 years ago

The parser keeps SV_YES, SV_NO and friends in arrays asis. But when converting at runtime into a list, via av_make and sv_setsv the SV_YES is lost and turned into a PVNV of 1

Special case sv_setsv_flags for the immortals (not possible, rather fix the callers), which also makes it faster for these. They don't need to be copied, they are immortal after all.

See https://github.com/rurban/Cpanel-JSON-XS/issues/161

This is esp. useful for XS roundtrips, treating booleans as such. Currently one needs to bless them into some magic Boolean package to survive roundtrips.