Firth icon indicating copy to clipboard operation
Firth copied to clipboard

Strings

Open hikari-no-yume opened this issue 9 years ago • 4 comments

They're in the spec as the literal, but lack any functions to manipulate them, and they're not actually implemented in the interpreter.

hikari-no-yume avatar Mar 23 '15 19:03 hikari-no-yume

A rather important note: strings should be made up of true Unicode characters (codepoints), not UTF-16 code units. That means a JS string of length four containing a surrogate pair would be a Firth string of length three, ideally.

hikari-no-yume avatar Mar 23 '15 19:03 hikari-no-yume

Another thing: it should have Unicode escape sequences with the \u{xxxx...} syntax I proposed for PHP: http://wiki.php.net/rfc/unicode_escape

hikari-no-yume avatar Mar 23 '15 19:03 hikari-no-yume

Some sort of string interpolation would be great. I'm tempted to just have printf and be done with it. Perhaps sprintf renamed to format.

hikari-no-yume avatar Mar 23 '15 19:03 hikari-no-yume

OK, the basics of this are done now: https://github.com/TazeTSchnitzel/Firth/commit/0a249c27593a446ea268854c00ff0e5434a2d681

All that's needed are Unicode escapes and some manipulation functions. Also, it should probably error if given invalid UTF-16 input (mismatched surrogate pairs) in source, even if that's unlikely to happen.

hikari-no-yume avatar Mar 30 '15 00:03 hikari-no-yume