John Porter <[EMAIL PROTECTED]> writes:

> Bryan C. Warnock wrote:
> > 
> > Composer::Post.assumes(Iterator.each(Iterator.all(List)=="Programmers")
> >     ->programs=(Language::Programming.uses("Perl")==true &&
> >     Methodology.implemented(Style.OO==true,Time.all==true)))==true;
> 
> Not at all.  But in  
> 
>       foo = bar;
> 
> foo could be just about anything: a string, a hashref, some other
> blessed ref (with op"=" possibly overloaded!), or even an lvalue sub.
> Do you know?  Should you care?

I don't know, but I think I should care.  Suppose C<bar> holds a
reference to a list.  What does C<foo = bar> do?  Does it make C<foo>
another reference to the same list, or does it make C<foo> a reference 
to a new copy of the same list, or does it make C<foo> a copy of the
same list?

In other words, what does this code print?

    bar = [1,1,1];                 # Bar is a list or a ref-to-list or summat
    foo = bar;
    foo[1] = 2;
    print bar[1], "\n";

The first case would say "1", the second and third (assuming there's
still a difference between them if we have auto-dereferencing).

Standard Perl5 practice writes the above 3 cases thus (assuming $bar
is a reference to a list):

    $foo = $bar;
    $foo = [@$bar];
    @foo = @$bar;

Now, the first and at least one of the remaining 2 are useful
operations, so Perl6 will need to support them with or without "line
noise".  So we'll need some new syntax to do this (and I hope it's not
"foo = bar.copy").  We can't even rely on "context" to do this, since
C<foo> doesn't have any context -- it could be a scalar, list, object
reference, or whatever.

The current way to do it makes the shallow copy vs. deep copy
distinction immediately visible, and reasonably hard to get wrong.  To
do the same with Highlanders would either require an inordinate amount
of declaration, or the use of specialised functions or methods for at
least some operations.

Some Highlander should probably take a look at Algol68 references;
I've never actually seen an Algol program, but I seem to remember a
professor at the university going on about how Algol68 did _some_
dereferencing automatically.

-- 
Ariel Scolnicov        |"GCAAGAATTGAACTGTAG"            | [EMAIL PROTECTED]
Compugen Ltd.          |Tel: +972-2-6795059 (Jerusalem) \ We recycle all our Hz
72 Pinhas Rosen St.    |Tel: +972-3-7658514 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555    http://3w.compugen.co.il/~ariels

Reply via email to