develooper Front page | perl.perl5.porters | Postings from September 2017

Re: Proposed new API function: sv_rvunweaken

Thread Previous
From:
ilmari
Date:
September 1, 2017 11:10
Subject:
Re: Proposed new API function: sv_rvunweaken
Message ID:
d8jinh2hdz1.fsf@dalvik.ping.uio.no
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 Heen

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About