Files
hakorune/apps/lib/std/operators/stringify.nyash

21 lines
636 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// std/operators/stringify.nyash
// StringifyOperator — 明示的な文字列化の演算子ボックス(開発用)
// 目的: 暗黙の toString に依存せず、観測可能な文字列化を提供する
static box StringifyOperator {
// apply(value) -> String
apply(value) {
// null 安全
if value == null {
return "null"
}
// stringify メソッドがあれば尊重JsonNodeInstance 等)
if value.stringify != null {
return value.stringify()
}
// それ以外は連結で安全に文字列化(プリミティブ toString 依存を避ける)
return "" + value
}
}