>
> On Sat, 10 Feb 2001, Branden wrote:
>
> > Suppose I have a string stored in $foo, say, "abcbca", and then I do:
> >
> > $bar = $foo;
> > $foo .= "xyzyzx";
> >
> > I see two ways of doing this: one is allowing a string value to be shared by
> > two or more variables, and the other one not.
>
> Why would you want to share the string value? Why did you assign the
> value of $foo to $bar if you really wanted to:
>
> $bar = \$foo;
>
> Or actually closer to what you seem to want:
>
> *bar = \$foo;
>
> Although a little birdy told me we're dropping globs for Perl6. Don't
> most programmers do assignment for a reason? Why should we second-guess
> them?
I think what he's thinking (in C terms) would be more like the following:
typedef struct { int length; char *s } string;
// $foo = "xyzzy";
string foo; foo.length = 5; foo.s = strdup("xyzzy---blank---buffer---space---");
// $bar = $foo;
string bar; bar.length = foo.length; bar.s = foo.s;
// $foo .= "xyzzy";
strncpy(foo.s+foo.length,"xyzzy",5); foo.length += 5;
// $foo and $bar share string buffers, but $bar only sees the first 5
// characters while $foo sees the first 10.
I don't see that as quite the same as the implicit references or
type-globs you suggested.
But it's late, and I might not know what I'm talking about...