Files
hakorune/apps/lib/std/operators/compare.hako

19 lines
686 B
Plaintext
Raw Permalink 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/compare.hako
// CompareOperator — 比較演算の演算子ボックス開発用観測MVP
// 目的: 比較を明示の呼び出しとして観測可能にするMVPでは返り値は未使用
static box CompareOperator {
// apply(op, a, b) -> Bool
apply(op, a, b) {
// 実評価採用フラグON時にVMが結果採用。演算子内は再入ガードで安全
if op == "Eq" { return a == b }
if op == "Ne" { return a != b }
if op == "Lt" { return a < b }
if op == "Le" { return a <= b }
if op == "Gt" { return a > b }
if op == "Ge" { return a >= b }
// 未知のopは false安全側
return false
}
}