develooper Front page | perl.perl6.internals | Postings from July 2002

Re: Mutable vs immutable strings

Thread Previous | Thread Next
Dan Sugalski
July 11, 2002 10:12
Re: Mutable vs immutable strings
Message ID:
At 2:13 PM -0700 7/10/02, John Porter wrote:
>Dan Sugalski wrote:
>>  John Porter wrote:
>>  > but what about non-PMC variables?
>>  Generally speaking, there aren't any. Everything else (in this case
>>  the buffer/string things) is for internal use only. Languages aren't
>>  supposed to expose strings directly.
>Languages are only supposed to expose PMCs?


>Not ints, nums, strs?

Nope. Well, mostly nope.

>Why have them if Perl can't see them?

The int and num registers are in there primarily for the compiler's 
use. Ints are useful for counters and offsets in lists as well as for 
the regex engine, while nums are useful for FP math. Strings are 
handy for the regex engine. All three are useful as temporaries in 
some situations, as well as for the code used to implement PMC 
functions. (It is, for example, perfectly acceptable to hand-code PMC 
functions in assembler, and for that you'd use the registers)

Aggregate PMCs *don't* have to be made up of PMCs themselves, though 
PMCs do have to be constructed as need be. So if you did "my str 
@foo;", @foo would be represented by a PMC, but each entry in it 
would be represented by a string structure.

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai                         have teddy bears and even
                                       teddy bears get drunk

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About