At 2:58 PM -0400 4/30/04, Bryan C. Warnock wrote:
On Fri, 2004-04-30 at 13:53, Dan Sugalski wrote:
 Parrot, at the very low levels, makes no distinction between strings
 and buffers--as far as it's concerned they're the same thing, and
 either can hang off an S register. (Ultimately, when *I* talk of
 strings I mean "A thing I can hang off an S register", though I'm in
 danger of turning into Humpty Dumpty here) That's part of the
 problem. There are already bitwise operations on S-register things in
 the core, which is OK.

Ahhh, now things are beginning to make a little more sense.

Or at least my unclarity is becoming clearer. :)

>
 The bitshift operations on S-register contents are valid, so long as
 the thing hanging off the register support it. Binary data ought
 allow this. Most 8-bit string encodings will have to support it
 whether it's a good idea or not, since you can do it now. If Jarkko
 tells me you can do bitwise operations with unicode text now in Perl
 5, well... we'll support it there, too, though we shan't like it at
 all.

 I *think* most of the variable-width encodings, and the character
 sets that sit on top of them, can reasonably forbid this.

<mode="dave barry"> Since "text" "strings" are a proper "subset" of a "binary" "buffer", which is really what the "string" "registers" really "are", what we've "logically" got is this: </mode>

LAYER 1 2 3
+-- Text Ops --- (Hosted Language)
SREG --+ +-- Bin Ops --- (Hosted Language)


or maybe this:

   SREG --- Bin Ops ----------- (Hosted Language)
               +-- Text Ops --- (Hosted Language)

where semantics are found in Layers 2 and 3.  (Layer 3 could also be
merged.)

Yep, that's basically it.

Now I think that's more less what Parrot has, right?  Except that the
Layer 2 semantics are tracked (and locked in?) at Layer 1?  (To prevent
the aforementioned bit-shifting of WTF strings.)

If you want, you could think of the S-register strings as mini-PMCs. The encoding and charset stuff (we'll ignore language semantics for the moment) are essentially small vtables that hang off the string, and whatever we do with it mostly goes through those vtable functions.


Which sort of argues for putting the bitstring stuff in there somewhere as well. (And may well argue for MMD on string operations, but I think that makes my head hurt so I'm not going there righ tnow)
--
Dan


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

Reply via email to