json(vm): fix birth dispatch; unify constructor naming (Box.birth/N); JsonNode factories return JsonNodeInstance; quick: enable heavy JSON with probe; builder: NYASH_BUILDER_DEBUG_LIMIT guard; json_query_min(core) harness; docs/tasks updated

This commit is contained in:
nyash-codex
2025-09-27 08:45:25 +09:00
parent fcf8042b06
commit cb236b7f5a
263 changed files with 12990 additions and 272 deletions

50
src/boxes/missing_box.rs Normal file
View File

@ -0,0 +1,50 @@
/*! ❓ MissingBox — 欠損/未設定の値を表す BoxNull と区別)
*
* 目的: JSON の欠損キー、未設定のフィールド、未初期化参照などを表現するための一級オブジェクト。
* 設計: Null明示的な無とは意味を分離。演算・比較・呼び出し境界に現れたら原則エラー。
* 既定: 本実装は型の導入のみ(生成はしない)。既定挙動は従来どおり不変。
*/
use crate::box_trait::{BoolBox, BoxBase, BoxCore, NyashBox, StringBox};
use std::any::Any;
use std::fmt::{Debug, Display};
#[derive(Debug, Clone)]
pub struct MissingBox {
base: BoxBase,
}
impl MissingBox {
pub fn new() -> Self {
Self { base: BoxBase::new() }
}
pub fn is_missing(&self) -> bool { true }
}
impl BoxCore for MissingBox {
fn box_id(&self) -> u64 { self.base.id }
fn parent_type_id(&self) -> Option<std::any::TypeId> { self.base.parent_type_id }
fn fmt_box(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
// 開発時の可視性向上のための文字列表現。prod では基本的に表面化させない想定。
write!(f, "(missing)")
}
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
}
impl NyashBox for MissingBox {
fn type_name(&self) -> &'static str { "MissingBox" }
fn to_string_box(&self) -> StringBox { StringBox::new("(missing)") }
fn clone_box(&self) -> Box<dyn NyashBox> { Box::new(self.clone()) }
fn share_box(&self) -> Box<dyn NyashBox> { self.clone_box() }
fn equals(&self, other: &dyn NyashBox) -> BoolBox {
// 欠損どうしは論理同値とみなすが、通常の等価比較は境界で禁止される想定。
BoolBox::new(other.as_any().downcast_ref::<MissingBox>().is_some())
}
}
impl Display for MissingBox {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.fmt_box(f) }
}

View File

@ -146,6 +146,7 @@ pub use egui_box::EguiBox;
pub use web::{WebCanvasBox, WebConsoleBox, WebDisplayBox};
pub mod null_box;
pub mod missing_box;
// High-priority Box types
pub mod array;
@ -168,6 +169,7 @@ pub mod p2p_box;
// null関数も再エクスポート
pub use null_box::{null, NullBox};
pub use missing_box::MissingBox;
// High-priority Box types re-export
pub use array::ArrayBox;