Types¶
Comefrom0x10 has two data types, Unicode strings and numbers.
Strings are truly Unicode, that is, you don’t need to worry about legacy surrogate pair nonsense giving you a wrong string length. Which would be relevant if Cf0x10 had a way to retrieve string length.
Numbers are integers or floating point in the most sensible way possible, so division gives approximately exact answers:
1/3 # prints 0.333333
Naturally, in this spirit of mathematical correctness, Cf0x10 knows how to handle division by zero:
0/0 # undefined
Undefined¶
The great third datatype, or, perhaps, meta-datatype is undefined
. Known in other languages as None
, Nothing
, nil
, void
or, if you’re in JavaScript both null
and undefined
, Cf0x10 adopts the great success of SQL in how it handles the unknown:
undefined is undefined # falsy
The example above is misleading however, because undefined
is not a keyword. The program above would be just as easily written:
frobnicate is foobar
In Cf0x10, there is nothing special about the name undefined
. It is a concept, the absence of value. In the first example, undefined
is just the name of a variable that is… not defined. Thus, this is a perfectly valid program, that prints… nothing:
undefined = 1
'fear nothing'
comefrom if undefined is 1
Coercion¶
4 2 |
String: “42” |
4 + 2/0 |
4 |
4 + '2' |
Undefined |
'4' + '2' |
Undefined (adding strings is nonsense) |
'4' '2' |
String: “42” |
'4' 2/0 |
String: “4” |