--- a/crates/jrsonnet-evaluator/README.md +++ b/crates/jrsonnet-evaluator/README.md @@ -31,10 +31,10 @@ test tests::bench_parse ... bench: 7,206,164 ns/iter (+/- 1,067,418) ``` -## Intristics +## Intrinsics -Some functions from stdlib are implemented as intristics +Some functions from stdlib are implemented as intrinsics -### Intristic handling +### Intrinsic handling -If indexed jsonnet object has field '__intristic_namespace__' of type 'string', then any not found field/method is resolved as `Val::Intristic(__intristic_namespace__, name)` +If indexed jsonnet object has field '__intrinsic_namespace__' of type 'string', then any not found field/method is resolved as `Val::Intrinsic(__intrinsic_namespace__, name)` --- a/crates/jrsonnet-evaluator/src/builtin/mod.rs +++ b/crates/jrsonnet-evaluator/src/builtin/mod.rs @@ -349,6 +349,6 @@ ], { Ok(v) })?, - (ns, name) => throw!(IntristicNotFound(ns.into(), name.into())), + (ns, name) => throw!(IntrinsicNotFound(ns.into(), name.into())), }) } --- a/crates/jrsonnet-evaluator/src/evaluate.rs +++ b/crates/jrsonnet-evaluator/src/evaluate.rs @@ -467,9 +467,9 @@ if let Some(v) = v.get(s.clone())? { Ok(v.unwrap_if_lazy()?) } else if let Some(Val::Str(n)) = - v.get("__intristic_namespace__".into())? + v.get("__intrinsic_namespace__".into())? { - Ok(Val::Func(Rc::new(FuncVal::Intristic(n, s)))) + Ok(Val::Func(Rc::new(FuncVal::Intrinsic(n, s)))) } else { throw!(NoSuchField(s)) } --- a/crates/jrsonnet-evaluator/src/val.rs +++ b/crates/jrsonnet-evaluator/src/val.rs @@ -76,7 +76,7 @@ /// Plain function implemented in jsonnet Normal(FuncDesc), /// Standard library function - Intristic(Rc, Rc), + Intrinsic(Rc, Rc), /// Library functions implemented in native NativeExt(Rc, Rc), } @@ -85,7 +85,7 @@ fn eq(&self, other: &Self) -> bool { match (self, other) { (FuncVal::Normal(a), FuncVal::Normal(b)) => a == b, - (FuncVal::Intristic(ans, an), FuncVal::Intristic(bns, bn)) => ans == bns && an == bn, + (FuncVal::Intrinsic(ans, an), FuncVal::Intrinsic(bns, bn)) => ans == bns && an == bn, (FuncVal::NativeExt(an, _), FuncVal::NativeExt(bn, _)) => an == bn, (..) => false, } @@ -93,12 +93,12 @@ } impl FuncVal { pub fn is_ident(&self) -> bool { - matches!(&self, FuncVal::Intristic(ns, n) if ns as &str == "std" && n as &str == "id") + matches!(&self, FuncVal::Intrinsic(ns, n) if ns as &str == "std" && n as &str == "id") } pub fn name(&self) -> Rc { match self { FuncVal::Normal(normal) => normal.name.clone(), - FuncVal::Intristic(ns, name) => format!("intristic.{}.{}", ns, name).into(), + FuncVal::Intrinsic(ns, name) => format!("intrinsic.{}.{}", ns, name).into(), FuncVal::NativeExt(n, _) => format!("native.{}", n).into(), } } @@ -120,7 +120,7 @@ )?; evaluate(ctx, &func.body) } - FuncVal::Intristic(ns, name) => call_builtin(call_ctx, loc, &ns, &name, args), + FuncVal::Intrinsic(ns, name) => call_builtin(call_ctx, loc, &ns, &name, args), FuncVal::NativeExt(_name, handler) => { let args = parse_function_call(call_ctx, None, &handler.params, args, true)?; let mut out_args = Vec::with_capacity(handler.params.len()); @@ -149,7 +149,7 @@ )?; evaluate(ctx, &func.body) } - FuncVal::Intristic(_, _) => todo!(), + FuncVal::Intrinsic(_, _) => todo!(), FuncVal::NativeExt(_, _) => todo!(), } } @@ -160,7 +160,7 @@ let ctx = place_args(call_ctx, Some(func.ctx.clone()), &func.params, args)?; evaluate(ctx, &func.body) } - FuncVal::Intristic(_, _) => todo!(), + FuncVal::Intrinsic(_, _) => todo!(), FuncVal::NativeExt(_, _) => todo!(), } } --- a/crates/jrsonnet-stdlib/src/std.jsonnet +++ b/crates/jrsonnet-stdlib/src/std.jsonnet @@ -1,5 +1,5 @@ { - __intristic_namespace__:: 'std', + __intrinsic_namespace__:: 'std', local std = self, local id = std.id,