Pete Goodeve wrote:
> str<>s->str;
When str starts off as the empty string, this is effectively the
same as
s->str;
i.e., you are making making the variable str point to the same thing
that the variable s points to. Then when you assign to s the next time,
you are assigning to str as well.
Concatenation with the empty string isn't creating a new string, as you
might assume. It isn't a bug in the implementation, but you might find
the design decision unintuitive coming from some other languages (many
of which probably didn't yet exist when the decision was taken).
Regards,
Stephen Isard
|