develooper Front page | perl.perl5.porters | Postings from August 2012

Re: fixing smartmatch just hard enough (and when, too)

Thread Previous | Thread Next
From:
David Golden
Date:
August 25, 2012 18:01
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
CAOeq1c-5DnWsBH3sJTjLXD9G47L1ge2OpzxQpMi7rgR-2bpq0A@mail.gmail.com
On Sat, Aug 25, 2012 at 8:20 PM, Ricardo Signes
<perl.p5p@rjbs.manxome.org>wrote:

>
> The other non-reference scalar type is vstring, but I think we're just fine
> with using string equality there.  Open to rebuttal!
>

You mean pure v-strings, not version objects?  String equality should be
fine.  I suspect the main reason the extra v-string information is attached
in magic is so that version.pm can handle alphas correctly should the
v-string ever get used to initialize a version object.

$ perl -MDevel::Peek -wE '$v=v1.2_3; Dump $v'
SV = PVMG(0x17653c0) at 0x1760738
  REFCNT = 1
  FLAGS = (SMG,RMG,POK,pPOK)
  IV = 0
  NV = 0
  PV = 0x1750ca0 "\1\27"\0
  CUR = 2
  LEN = 16
  MAGIC = 0x175a560
    MG_VIRTUAL = &PL_vtbl_vstring
    MG_TYPE = PERL_MAGIC_vstring(V)
    MG_LEN = 6
    MG_PTR = 0x1762460 "v1.2_3"

-- 
*David Golden* <dagolden@cpan.org>
*Take back your inbox!* → http://www.bunchmail.com/
Twitter/IRC: @xdg

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