On Thu, 10 May 2007, Nicholas Clark wrote:
> But when I read STRING_IS_EMPTY() I stop and wonder "right, how?" and
> stop to look up what it expands to. Which one does need to do, if one
> is chasing down a bug. (Because with a bug, things *aren't* working as
> at least one of the designer or implementor intended, which means
> assumptions need to be checked. Maybe I'm odd)
Probably, but you're not alone! In perl5, I know I've made a lot of use
of the .c.i Makefile rule. In parrot, the equivalent exercise for me
seems to be tracing all the indirections and structure casting.
> So, personally, I find it easier with a comment on the struct by that
> member, saying that an empty string has zero length.
>
> Mmm, looking at it right now:
>
> struct parrot_string_t {
> pobj_t obj;
> UINTVAL bufused;
> char *strstart;
> UINTVAL strlen;
> /* parrot_string_representation_t representation;*/
> struct _encoding *encoding;
> struct _charset *charset;
> UINTVAL hashval; /* cached hash value computation; not yet used */
> };
>
>
> It makes me wonder what's the difference between bufused and strlen.
bufused is in bytes; strlen is in "characters", determined by calling the
string's encoding->codepoints function:
((ENCODING *)s->encoding)->codepoints(interp, s)
--
Andy Dougherty [EMAIL PROTECTED]