为什么 .ords 与 .chars 不一致?

Why does .ords not agree with .chars?

我对.chars的理解是returns"the number of characters in the string in graphemes". My understanding of .ords is that it returns "a list of codepoint numbers, one for the base character of each grapheme in the string"。也就是说,.chars returns 字素的数量和 .ords returns 每个字素一个代码点(基础)。但是,我在 MoarVM 2016.07 上的 Rakudo 2016.07.1 中看到的行为似乎与此不符:

> "\x[2764]\x[fe0e]".chars
1
> "\x[2764]\x[fe0e]".ords.fmt("U+%04x")
U+2764 U+fe0e
> "e\x[301]".ords.fmt("U+%04x")
U+00e9
> "0\x[301]".ords.fmt("U+%04x")
U+0030

.chars 方法 returns HEAVY BLACK HEART 和 VARIATION SELECTOR-15 的 expect 1(文本表示 ❤︎ 而不是表情符号 ❤️,U+2764 U+fe0f),然后 .ords returns 两个代码点而不仅仅是基本代码点(我预计只有 U+2764)。更令人困惑的是,如果您在拉丁文小写字母 E 上调用 .ords 并结合重音符号,您会返回 U+00e9(带尖音符的拉丁文小写字母 E)。我期待 U+0065,因为拉丁文小写字母 E 是基本代码点。当没有字符串的 NFC 版本(例如 U+0030 代表 0´)时,我确实得到了预期的结果。

我对 .chars.ords 的理解是有缺陷的,还是这是一个错误?

关于 .ords 方法的文档错误。一位核心开发人员刚刚使用此提交更新了文档:

https://github.com/perl6/doc/commit/12ec5fc35e

应该很快就会出现在网站上。