Comment #1 on issue 1656 by [email protected]: Reconsider naming scheme of String::IsAsciiRepresentation and String::IsAsciiRepresentationUnderneath
http://code.google.com/p/v8/issues/detail?id=1656

I agree the word "representation" is bad.
For string objects, the ASCII/TwoByte distinction is actually called Encoding in most places (Representation is whether it's Cons/Seq/External/Sliced) - but there are inconsistent uses spread around the code base too.

In this case, the name should tell about the possible encoding of the content of the string, as you say. I'd go for HasAsciiContent() or HasAsciiCharacters() (and drop the TwoByte equivalent, because all strings have valid two-byte content, and if it's the inverse of HasAsciiContent(), it's unnecessary). If it's not clear enough, perhaps even HasOnlyAsciiCharacters()

As for IsAsciiRepresentationUnderneath(), it checks the actual Encoding of the underlying sequential/external string (we could use a name for strings with those two representations, because Flat is already used, and it would otherwise be perfect). Maybe something like IsBackingStringAscii(). There can be an IsBackingStringTwoByte() too, but it'll probably only be used in assertions.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to