in reply to Re^2: Perl 6: Static/Dynamic Strong/Weak Type Systems
in thread Perl 6: Static/Dynamic Strong/Weak Type Systems
might read the first 9 bytes of the SV structure for $a but it just has length 0. Do you have a demo?#! /usr/bin/perl -l $a="fergal"; $p=\$a+0; print $p; $x=unpack("P9", pack 'j', $p); print length($x);
Anyway, this is not really what I'm getting at. You can't use this to try treat the memory for a perl array variable as a perl string variable, at most this allows you to treat the memory for a perl array variable as the C string inside a perl string variable.
Imagine you could twiddle the pointer inside a perl reference value, it still wouldn't be weakly typed. If you point the ref at a bit of memory that contains a perl string variable then it will become a string-ref if you point it at an array variable it will become an array-ref (I think this is the case although I'm not an XS whizz and I don't have time to test it as I'm going on holidays in an hour!). So for perl to be weakly typed I would have to wrong and the language would have to have this reference twiddling feature built in.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Perl 6: Static/Dynamic Strong/Weak Type Systems
by rcaputo (Chaplain) on Apr 16, 2006 at 18:26 UTC | |
Re^4: Perl 6: Static/Dynamic Strong/Weak Type Systems
by diotalevi (Canon) on Apr 17, 2006 at 04:51 UTC |