Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Clone

7 views
Skip to first unread message

Alberto Simões/epl

unread,
Apr 16, 2003, 7:25:24 AM4/16/03
to perl6-i...@perl.org

Hi, all.

Of course I can test this on parrot, but that gives me the answer for today,
not for parrot objectives.

Something like

clone P0, P1

where P1 is an array (or hash, or something else) will clone P1 elements, or
clone references for the P1 elements?

Best regards,
Alberto
--
Departamento de Informatica - Universidade do Minho

"The C Programming Language -- A language which combines the
flexibility of assembly language with the power of assembly language."

Leopold Toetsch

unread,
Apr 16, 2003, 8:42:21 AM4/16/03
to al...@alfarrabio.di.uminho.pt, perl6-i...@perl.org
Alberto Simões/EPL wrote:

> Hi, all.


>
> clone P0, P1
>
> where P1 is an array (or hash, or something else) will clone P1 elements, or
> clone references for the P1 elements?


The former, and rescursively, which will be great fun for self
referencing structures ;)


> Best regards,
> Alberto


leo


Luke Palmer

unread,
Apr 16, 2003, 10:10:26 AM4/16/03
to l...@toetsch.at, al...@alfarrabio.di.uminho.pt, perl6-i...@perl.org
> Alberto Simões/EPL wrote:
>
> > Hi, all.
> >
> > clone P0, P1
> >
> > where P1 is an array (or hash, or something else) will clone P1
> > elements, or clone references for the P1 elements?
>
>
> The former, and rescursively, which will be great fun for self
> referencing structures ;)

Um, why? Deep copy is seldom needed, where shallow copy is used all
the time. How do you shallow copy?

Luke

Leopold Toetsch

unread,
Apr 17, 2003, 6:17:35 AM4/17/03
to Luke Palmer, al...@alfarrabio.di.uminho.pt, perl6-i...@perl.org
Luke Palmer wrote:

[ clone ]


> Um, why? Deep copy is seldom needed, where shallow copy is used all
> the time. How do you shallow copy?


We don't have a notation to say shallow or deep. Proably the clone
opcode needs one extra param stating the desired behavior.


> Luke


leo


Dan Sugalski

unread,
Apr 17, 2003, 10:12:14 AM4/17/03
to Leopold Toetsch, al...@alfarrabio.di.uminho.pt, perl6-i...@perl.org
At 2:42 PM +0200 4/16/03, Leopold Toetsch wrote:
>Alberto Simões/EPL wrote:
>
>>Hi, all.
>>
>> clone P0, P1
>>
>>where P1 is an array (or hash, or something else) will clone P1 elements, or
>>clone references for the P1 elements?
>
>
>The former, and rescursively, which will be great fun for self
>referencing structures ;)

Ah, it's not that bad if we get the GC machinery in the act to help
with data structure marking...
--
Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk

Dan Sugalski

unread,
Apr 17, 2003, 10:12:32 AM4/17/03
to Luke Palmer, l...@toetsch.at, al...@alfarrabio.di.uminho.pt, perl6-i...@perl.org
At 8:10 AM -0600 4/16/03, Luke Palmer wrote:
> > Alberto Simões/EPL wrote:
>>
>> > Hi, all.
>> >
>> > clone P0, P1
>> >
>> > where P1 is an array (or hash, or something else) will clone P1
>> > elements, or clone references for the P1 elements?
>>
>>
>> The former, and rescursively, which will be great fun for self
>> referencing structures ;)
>
>Um, why?

Because I said so? :-P

>Deep copy is seldom needed, where shallow copy is used all
>the time. How do you shallow copy?

With assign.

0 new messages