List Info

Thread: Re: stronger type determination (was Re: the utf8 flag ...)




Re: stronger type determination (was Re: the utf8 flag ...)
user name
2007-03-31 06:44:18
On 3/31/07, Darren Duncan <darrendarrenduncan.net>
wrote:
> This is assuming that Perl actually records 42 and
"42" differently;
> if it doesn't, then I won't ask for the ability to
discriminate since
> Perl itself doesn't; but if Perl treats those
differently, I want to
> as well.

The answer to your question is that sometimes perl can
discriminate
and sometimes perl can't. For instance 42 will be an SvIV to
start off
with, and "42" will be a SvPV to start off with.
However if these
variables were used in various way then they could easily
both end up
as SvPVIV at which point I dont think that there is any way
to tell
them apart. Perlguts illustrated[1] has a nice chart that
illustrates
how the types fit together.

Its also worth keeping in mind that firmly defining 'type'
in perl is
a bit difficult. Is it the SvTYPE field? Is it the SvTYPE
field plus
the flags, do you count the utf8 flag, etc. Do you include
magic in
type? Where does blessedness fit in? yada yada

[1] http://gisle.aas.no
/perl/illguts/

cheers,
Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )