Generic const - a non-functional view

Bill Baxter dnewsgroup at billbaxter.com
Wed Jun 25 23:00:34 PDT 2008


Me Here wrote:
> Walter Bright wrote:
> 
> Perl has invariant strings, but they are implicitly invariant
>> and so nobody notices it, they just work.
>>
> Sorry Walter, but thta is simply not the case: Vis:
> 
> [0] Perl> $x = 'x' x 500e6;
> [0] Perl> print length $x;;
> 500000000
> [0] Perl> substr $x, 250e6, 1, 'y';;
> [0] Perl> print length $x;;
> 500000000
> [0] Perl> print substr $x, 250e6-5, 10;;
> xxxxxyxxxx
> 
> b.

What are you disagreeing with?

The fact that they're invariant?
Or the fact that nobody notices?

I have no idea if they're invariant in perl or not.  But I don't think 
your test above is conclusive proof that they're mutable.

--bb



More information about the Digitalmars-d mailing list