2025-09-22 21:52:39 +09:00
|
|
|
// ConsoleStd — minimal standard console helpers (commonized API)
|
|
|
|
|
|
2025-09-23 13:03:35 +09:00
|
|
|
// Global helper to avoid name shadowing when invoking the language-level print.
|
|
|
|
|
function __console_std_emit(value) {
|
|
|
|
|
print(value)
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-22 21:52:39 +09:00
|
|
|
static box ConsoleStd {
|
|
|
|
|
// print/println/log: convert null to "" and return 0
|
|
|
|
|
print(x) {
|
|
|
|
|
if x == null { x = "" }
|
2025-09-23 13:03:35 +09:00
|
|
|
__console_std_emit(x)
|
2025-09-22 21:52:39 +09:00
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
println(x) {
|
|
|
|
|
if x == null { x = "" }
|
2025-09-23 13:03:35 +09:00
|
|
|
__console_std_emit(x)
|
2025-09-22 21:52:39 +09:00
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
log(x) {
|
|
|
|
|
if x == null { x = "" }
|
2025-09-23 13:03:35 +09:00
|
|
|
__console_std_emit(x)
|
2025-09-22 21:52:39 +09:00
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|