Zefram <zefram@fysh.org> writes: > Dagfinn Ilmari Mannsaker wrote: >> if (!SvOK(sv)) /* let undefs pass */ >> return sv; >> if (!SvROK(sv)) >> Perl_croak(aTHX_ "Can't unweaken a nonreference"); > > This combination of semantics is rather arbitrary. I'd prefer > that the API function have a consistent treatment of things other > than weak references: either croak on all, or return all unchanged. > Whatever the semantics, especially if they remain inconsistent, they > must be documented. It's consistent with what sv_rvweaken() and Scalar::Util::unweaken() have always done (since 1999, and 2014, respectively). I'll add a mention to the documentation. - ilmari -- "I use RMS as a guide in the same way that a boat captain would use a lighthouse. It's good to know where it is, but you generally don't want to find yourself in the same spot." - Tollef Fog HeenThread Previous