== in Hem is strict equality: it compiles to ===, and coercing equality is not expressible. Beyond that, Hem removes truthiness entirely: conditions, !, &&, and || require boolean operands.
if items.length { flush(items) }error[HEM2002] dashboard.hem:8:4
|
8 | if items.length {
| ^^^^^^^^^^^^ This condition has type `number`, not `boolean`. Compare it explicitly before branching.Write the comparison you mean: if items.length > 0 { flush(items) }.
Defaulting belongs to ??, absence checks to == None (§6). Each of JavaScript’s truthiness jobs gets an explicit, typed spelling.
+ gets the same discipline: it is arithmetic only. Both operands must be number, or both bigint: never a string, and never a mix. String concatenation has exactly one spelling in Hem, a template literal:
let name = "Ada"
let greeting = "Hello, " + nameerror[HEM2021] app.hem:2:16
|
2 | let greeting = "Hello, " + name
| ^^^^^^^^^^^^^^^^ `+` cannot combine string-ish operands; write `${"Hello, "}${name}` as a template literal instead.Write `Hello, ${name}` instead. += follows the same rule. Unary + narrows further: it is a coercion in disguise, so it requires an already-number operand; write Number(x) rather than +x on anything that isn’t already a number.