develooper Front page | perl.perl5.porters | Postings from April 2015

[perl #122281] [PATCH] clean up sv_isobject usage

From:
bulk88 via RT
Date:
April 28, 2015 16:50
Subject:
[perl #122281] [PATCH] clean up sv_isobject usage
Message ID:
rt-4.0.18-2532-1430239840-1645.122281-15-0@perl.org
On Sun Jul 20 17:51:02 2014, tonyc wrote:
> One pattern I see a lot in this patch is replacing C<<
> sv_isobject(foo) >> with C<< SvROK(e) && SvOBJECT(SvRV(e)) >> to skip
> the magic in sv_isobject().
> 
> Wouldn't it be better to define a sv_isobject_nomg() macro?
> 
> Tony

I dont think so. "sv_isobject_nomg" assumes there is a function call inside the macro, there isn't any in "SvROK(e) && SvOBJECT(SvRV(e))". Thev "SvROK(e) && SvOBJECT(SvRV(e))" expression is short enough that new API isn't really needed and will just make code more difficult understand  (from a quick look, "SvROK(e) && SvOBJECT(SvRV(e))" is obviously function call free, and "lightweight", sv_isobject_nomg() is "heavyweight" and obviously has a function call inside).

-- 
bulk88 ~ bulk88 at hotmail.com

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=122281



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