On 2/9/19 2:28 PM, ToddAndMargo via perl6-users wrote:
On 2/9/19 1:56 PM, ToddAndMargo via perl6-users wrote:
Hi All,
sub xxx( Buf $YugeBuf is ro ) {some midricle}
Is $YugeBuf (up to 100 MB) a copy of just the structure?
I don't want the time time of a copy.
Many thanks,
-T
Without all the typos:
Hi All,
sub xxx( Buf $YugeBuf is ro ) {some miricle}
Is $YugeBuf (up to 100 MB) a copy of the entire variable
or just the structure? I don't want the time hit of a copy.
Many thanks,
-T
It is not a duplicate:
[20:30] <ToddAndMargo> A question for the developers. sub xxx( Buf
$YugeBuf is ro ) {some miricle} Is $YugeBuf (up to 100 MB) a copy of
the entire variable or just the structure? I don't want the time hit of
a copy
[20:32] == Cabanossi
[~cabano...@ppp-88-217-73-102.dynamic.mnet-online.de] has joined #perl6
[20:36] == kurahaupo_
[~kuraha...@pa49-195-197-60.pa.nsw.optusnet.com.au] has joined #perl6
[20:36] == kurahaupo [~kurahaupo@125.254.10.75] has quit [Read error:
Connection reset by peer]
[20:36] <guifa> ToddAndMargo: it seems to be
[20:37] == kurahaupo_
[~kuraha...@pa49-195-197-60.pa.nsw.optusnet.com.au] has quit [Read
error: Connection reset by peer]
[20:38] <guifa> p6: sub a (Buf $b) { say $b.WHERE }; my $c =
Buf.new(1,2,3); say $c.WHERE; a($c)
[20:38] <+camelia> rakudo-moar d904b7048: OUTPUT:
«139828431461220139828431461220»
[20:39] == kurahaupo [~kurahaupo@125.254.10.75] has joined #perl6
[20:45] == kurahaupo [~kurahaupo@125.254.10.75] has quit [Read error:
Connection reset by peer]
[20:45] <guifa> Err, I meant that to be "Buf $b is readonly" but result
is the same.
[20:46] == kurahaupo [~kurahaupo@125.254.10.75] has joined #perl6
[20:48] == aindilis
[~aindi...@172-12-3-117.lightspeed.sgnwmi.sbcglobal.net] has quit [Ping
timeout: 240 seconds]
[20:49] <guifa> Even when you use "is copy", the copy doesn't get made
until after the value has been modified. Seems Rakudo is smart in that
regards:
[20:49] <guifa> p6: sub a ($a is copy) { say $a.WHERE; $a++; say
$a.WHERE}; my $b = 1; say $b.WHERE; a($b)
[20:49] <+camelia> rakudo-moar d904b7048: OUTPUT:
«140226293132168140226293132168140226293132208»
[20:49] == aindilis
[~aindi...@172-12-3-117.lightspeed.sgnwmi.sbcglobal.net] has joined #perl6
[20:53] <guifa> Just be aware that readonly doesn't necessarily mean
what you might think it does:
[20:53] <guifa> p6: sub a (Buf $b is readonly) { $b[0] = 0}; my $c =
Buf.new(1,2,3); a($c); say $c
[20:53] <+camelia> rakudo-moar d904b7048: OUTPUT: «Buf:0x<00 02 03>»