[Grace-core] Strings

Lex Spoon lex at lexspoon.org
Mon Feb 2 14:57:56 PST 2015


On Mon, Feb 2, 2015 at 4:00 PM, James Noble <kjx at ecs.vuw.ac.nz> wrote:

> On 28/01/2015, at 06:33 am, Lex Spoon <lex at lexspoon.org> wrote:
>
> > Go does not have that constraint, and they went with narrow, byte-based
> strings. That strikes me as a good choice. Java, JavaScript, and the
> Microsoft foundation libraries all use wide strings, but it hasn't worked
> out very well in practice.
>
> Lex - right - but as Michael pointed out, that will be difficult to
> understand, especially for novices, when iterating through the string
> produces bytes, not characters.  Or am I missing something here?
>
> being able to write this seems quite important to me - James
>
>
> def myName = "Pélé  ℬヂコ"
>
> print "whole name: {myName}"
> print "each character"
> for (myName) do { char - > print(char) }
>
>
No, I agree--the most obvious APIs that students run into should use code
points. That can be done on top of a UTF-8-based string.

There are a lot of ins and outs to this conversation. The only part that's
especially clear is that it's somewhat risky to define a new string type
from scratch. Things are likely to work better if a Grace string compiles
to a native string for the target platform.

That string can have Graceful methods on it, though, when viewed from a
Grace program. Especially if I don't have to implement it and can just
declare that somebody else will make it work!

Lex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailhost.cecs.pdx.edu/pipermail/grace-core/attachments/20150202/e887f1d5/attachment.html>


More information about the Grace-core mailing list