WebAssembly / stringref

Other
37 stars 2 forks source link

String slice operands should have exclusive end #17

Closed wingo closed 2 years ago

wingo commented 2 years ago

The current text for stringview_wtf16.slice says "Return a substring of view, for the WTF-16 code units starting at offset start and not greater than end". However this is annoying:

  (stringview_wtf16.slice (string.as_wtf16 (string.const "hey")) (i32.const 0) (i32.const 0)))
  => "h"

I think I would expect a slice from 0 to 0 to be the empty string. So I guess the wording should be "starting at offset start and less than end", or something similar.