`Str.len`, `Str.upper`, `Str.lower`, `Str.sub`, and several others are declared as returning `Option` because they wrap Lua externs that could theoretically return nil — but for these specific functions with valid inputs, they never do.
The result is that every call inside the stdlib itself ends with `.unwrap_or(0)` or `.unwrap_or("")`, which is noise. Callers have to unwrap values that will never be `None`.
These functions should return their concrete type directly. The `Option` wrapper should only be kept for functions that genuinely return nil for valid inputs (like `Str.find`, which returns `None` when the substring isn't found).
`Str.len`, `Str.upper`, `Str.lower`, `Str.sub`, and several others are declared as returning `Option` because they wrap Lua externs that could theoretically return nil — but for these specific functions with valid inputs, they never do.
The result is that every call inside the stdlib itself ends with `.unwrap_or(0)` or `.unwrap_or("")`, which is noise. Callers have to unwrap values that will never be `None`.
These functions should return their concrete type directly. The `Option` wrapper should only be kept for functions that genuinely return nil for valid inputs (like `Str.find`, which returns `None` when the substring isn't found).