3 ms·
This has null-safety. As in, you can't assign null to a variable without explicitly qualifying that variable as "nullable". Glad to see this. But it's yet anot
by deathanatos 13y ago
This has null-safety. As in, you can't assign null to a variable without explicitly qualifying that variable as "nullable". Glad to see this.
But it's yet another language with strings-are-a-list-of-code-units. I've mentioned it before, but I'd like more languages to follow Haskell/Python's suite of "String are a list of code points", at the very least. (Those as others have point out, while dealing with code points is less error prone than code units, you probably want something even higher level.)
Integers are still range-limited. For some things this is okay, for some things it'd be nice to not worry about what happens when you get near 4B. Python solved this nicely. (There's a place for range-limited ints, and you can always have a ranged_int<0, 65565> type, or something. But by default, I don't want to think about overflow!)
Generics appear to be C#/Java like (i.e., limited, not full meta-programming).
Some things that run when targets to the JVM don't in JS. `for(c in "a string")` didn't compile for JS, nor did `1000000000000000 or 0`. (To be sure, this isn't exactly easy.)
(Last, the issue tracker infinite-redirects, likely because it doesn't handle a browser rejecting cookies.)
- DigitalJack 13y agoCould you take a crack at explaining code-unit vs code-point? I'd never heard of them, and they sort of looked like the same thing on Wikipedia.
- aardvark179 13y agoA code unit is the minimal bit length for a character in a particular encoding, so in UTF16 that's 16 bits and in UTF8 it's 8 bits. A code point is a character, that may be encoded by a single code unit or may require multiple code units. Mostly Java handles strings as 16bit code units, code point functions were only introduced at 1.5.
- DigitalJack 13y agoSo, a dumb question, If a code unit is the minimal bit length for encoding a character: why would you need more than one to encode a character? Is this just a way of saying "variable bit length character encoding?"
- lmm 13y agoIf your character encoding is fixed-bit-length then a code point and a code unit are the same thing yes. If your character encoding is variable-bit-length then a code point is a "character" and a code unit is the thing that a character may be 1 or more of (i.e. a byte in utf8, or a 2-byte thingummy in utf16). The point is that it's better to treat strings as sequences of unicode codepoints ("characters") than treat them as sequences of 16-bit utf16 units like Java does.