Problem
x = if false: 1
// x === null
y = (->
if false:
1
)()
// y === undefined
Wrapping an expression in a function had better not change its value.
Proposed Solution
While trying to work around JavaScript's proliferation of distinct-yet-falsy values may be noble in spirit, the fact that JavaScript returns undefined by default basically forces LSC to do the same for consistency's sake. I think unprovided branches of conditional expressions (if, and possibly match if it doesn't throw-on-else) should be returning undefined to match up with JavaScript core function behavior.
Problem
Wrapping an expression in a function had better not change its value.
Proposed Solution
While trying to work around JavaScript's proliferation of distinct-yet-falsy values may be noble in spirit, the fact that JavaScript returns
undefinedby default basically forces LSC to do the same for consistency's sake. I think unprovided branches of conditional expressions (if, and possiblymatchif it doesn't throw-on-else) should be returningundefinedto match up with JavaScript core function behavior.