[Nickle]UTF8 and bool type
Keith Packard
nickle@nickle.org
Mon, 22 Jul 2002 23:32:29 -0700
I'd like to propose a couple of changes to nickle, the first is to switch
the string representation to Unicode. Strings will appear as a sequence of
32-bit Unicode values. Strings read and written in "raw" form will be
encoded using UTF-8. The internal representation is also UTF-8, but this
isn't visible to applications.
Three new File namespace functions are needed:
File::getcharacter (file f) - parse the next UTF-8 char
File::ungetcharacter (int c, file f) - push the specified char back as UTF-8
File::putcharacter (file f) - output c in UTF-8 format
As always, suggestions for the names are welcome.
The second change is a bit more fundemental. Nickle has always allowed any
type to appear in expressions where a boolean value was needed; the test
was always whether the computed value was not equal to 0. I propose to
add a real boolean type (name bool). This type will have two values,
'true' and 'false' and will be the required type for all primitive
conditional tests (if, while, do, for, twixt, ?:).
The 'bool' type will be extremely useful in the future as algebraic types
are added, but even now, it should catch a large class of errors which
would otherwise go undetected.
-keith