in reply to Why not perl have raw/native type
Basically since Perl is highly dynamic, you can't prevent somebody from doing:
my $ref; { my native str $bb = 'hello world'; $ref = \$bb; } print $$ref;
Perl expects any variable to be at least of type SV. The closest you can get to a "native" variable is to use the PV slot of the variable and point it to your raw memory. You will still get reference counting and everything, but Perl expects all variables to support that.
Also note that by carefully looking at the code path, you can often prevent (needless) copying of data, for example by using DBI bind parameters instead of using ->fetchrow.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Why not perl have raw/native type
by LanX (Saint) on Jan 09, 2020 at 04:25 UTC | |
by Corion (Patriarch) on Jan 09, 2020 at 08:57 UTC | |
by LanX (Saint) on Jan 09, 2020 at 16:59 UTC | |
by dave_the_m (Monsignor) on Jan 09, 2020 at 07:56 UTC | |
by LanX (Saint) on Jan 09, 2020 at 08:18 UTC | |
by dave_the_m (Monsignor) on Jan 10, 2020 at 21:28 UTC | |
by LanX (Saint) on Jan 10, 2020 at 22:27 UTC |
In Section
Seekers of Perl Wisdom