develooper Front page | perl.perl5.porters | Postings from May 2013

Re: Proposal: initial type annotation in SV

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
May 14, 2013 00:16
Subject:
Re: Proposal: initial type annotation in SV
Message ID:
20130514001607.GB19498@fernweh.plasmasturm.org
* Ken Williams <kwilliams@cpan.org> [2013-05-13 20:15]:
> Dave Mitchell <davem <at> iabyn.com> writes:
> >    * the serialiser documentation could state that for things to be saved
> >      as floats, you must do *= 1.0 shortly before saving;
>
> That doesn't actually work:
>
> % perl -MDevel::Peek -E '$x=1; print Dump $x; $x *= 1.0; $x += 0.0;
> print Dump $x'
> SV = IV(0x1fbe7458) at 0x1fbe7468
>  REFCNT = 1
>  FLAGS = (IOK,pIOK)
>  IV = 1
> SV = IV(0x1fbe7458) at 0x1fbe7468
>  REFCNT = 1
>  FLAGS = (IOK,pIOK)
>  IV = 1

Good point. This does:

    $ perl -MDevel::Peek -E '$x=1; Dump $x; $x /= 1; Dump $x'
    SV = IV(0x7f7fc182aab0) at 0x7f7fc182aac0
      REFCNT = 1
      FLAGS = (IOK,pIOK)
      IV = 1
    SV = PVNV(0x7f7fc1802470) at 0x7f7fc182aac0
      REFCNT = 1
      FLAGS = (NOK,pNOK)
      IV = 1
      NV = 1
      PV = 0

-- 
*AUTOLOAD=*_;sub _{s/::([^:]*)$/print$1,(",$\/"," ")[defined wantarray]/e;chop;$_}
&Just->another->Perl->hack;
#Aristotle Pagaltzis // <http://plasmasturm.org/>

Thread Previous | Thread Next


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