feat: replace public byteAt with private byteAt_ and add O(1) bytes.count
Remove the public `byteAt(_)` method from String and its ByteSequence wrapper, renaming it to the private `byteAt_(_)` to eliminate redundancy with `.bytes[_]`. Add a native `byteCount_` primitive on String and expose it as `count` on StringByteSequence, enabling O(1) byte length queries. Update all test files to use the new `.bytes` subscript API and add a dedicated `count.wren` test for the new functionality.
This commit is contained in:
+4
-2
@@ -137,9 +137,11 @@ class StringByteSequence is Sequence {
|
||||
_string = string
|
||||
}
|
||||
|
||||
[index] { _string.byteAt(index) }
|
||||
[index] { _string.byteAt_(index) }
|
||||
iterate(iterator) { _string.iterateByte_(iterator) }
|
||||
iteratorValue(iterator) { _string.byteAt(iterator) }
|
||||
iteratorValue(iterator) { _string.byteAt_(iterator) }
|
||||
|
||||
count { _string.byteCount_ }
|
||||
}
|
||||
|
||||
class List is Sequence {
|
||||
|
||||
Reference in New Issue
Block a user