-
The assert that checks out of bound access in String_string_MINUS_set_BANG_ uses strlen instead of the value given to malloc. This makes the function unusable on empty strings.
-
In the core implementation the length of a string is the strlen of it, and not the initial value given to malloc, this should be documented.
(let [my-string (String.allocate 10 (Char.from-int 0))]
(do
(println* (String.length &my-string)) ;; Length is 0, not 10
(String.string-set! &my-string 1 'a') ;; Assertion fails (Thinks its out of bounds because it checks that the index is less than `strlen`
))