develooper Front page | perl.perl6.internals | Postings from June 2001

RE: The internal string API

Thread Previous | Thread Next
Dan Sugalski
June 19, 2001 12:41
RE: The internal string API
Message ID:
At 12:25 PM 6/19/2001 -0700, Hong Zhang wrote:

> > >What do you mean by character size if it does not support variable
> >
> > Well, if strings are to be treated relatively abstractly, and we still
> > to poke around through the string buffer, we need to know how big a
> > character is.
>I agree on this. I think support variable length encoding should be

We certainly need to support them. I'd rather the core interpreter code not 
deal with variable-width data directly, but I'm not sure that I'm going to 
get that wish. :(

> > >The byte based is more useful. I have utf-8, and I want to substr it
> > >to another utf-8. It is painful to convert it or linear search for
> > >charaacter position.
> >
> > The pain is the reason for specifying it in the API. If we force the pain
> > to be local to the encoding then it means that we don't have
> > to embed it in the core.
>If it is common API, I like to specify it in core, so each encoding
>implemetation can strictly follow. I believe it is common enough.

What I meant was that the core interpreter itself won't know how to grovel 
through a string buffer filled with variable-length characters. Instead it 
leaves that grovelling to the encoding specific code, which will 
(hopefully) be dynamically loadable. Basically the core specifies the API 
and conformant encoding implementations hide all the gory details.


--------------------------------------"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