difftreelog
fix `Intrinsic` typo leftovers
in: master
5 files changed
crates/jrsonnet-evaluator/README.mddiffbeforeafterboth1# jrsonnet-evaluator23Interpreter for parsed jsonnet tree45## Standard library67jsonnet stdlib is embedded into evaluator, but there is different modes for this:89- `codegenerated-stdlib`10 - generates source code for reproducing stdlib AST ([Example](https://gist.githubusercontent.com/CertainLach/7b3149df556f3406f5e9368aaa9f32ec/raw/0c80d8ab9aa7b9288c6219a2779cb2ab37287669/a.rs))11 - fastest on interpretation, slowest on compilation (it takes more than 5 minutes to optimize them by llvm)12- `serialized-stdlib`13 - serializes standard library AST using serde14 - slower than `codegenerated-stdlib` at runtime, but have no compilation speed penality15- none16 - leaves only stdlib source code in binary, processing them same way as user supplied data17 - slowest (as it involves parsing of standard library source code)1819Because of `codegenerated-stdlib` compilation slowdown, `serialized-stdlib` is used by default2021### Benchmark2223Can also be run via `cargo bench`2425```markdown26# codegenerated-stdlib27test tests::bench_codegen ... bench: 401,696 ns/iter (+/- 38,521)28# serialized-stdlib29test tests::bench_serialize ... bench: 1,763,999 ns/iter (+/- 76,211)30# none31test tests::bench_parse ... bench: 7,206,164 ns/iter (+/- 1,067,418)32```3334## Intristics3536Some functions from stdlib are implemented as intristics3738### Intristic handling3940If indexed jsonnet object has field '__intristic_namespace__' of type 'string', then any not found field/method is resolved as `Val::Intristic(__intristic_namespace__, name)`1# jrsonnet-evaluator23Interpreter for parsed jsonnet tree45## Standard library67jsonnet stdlib is embedded into evaluator, but there is different modes for this:89- `codegenerated-stdlib`10 - generates source code for reproducing stdlib AST ([Example](https://gist.githubusercontent.com/CertainLach/7b3149df556f3406f5e9368aaa9f32ec/raw/0c80d8ab9aa7b9288c6219a2779cb2ab37287669/a.rs))11 - fastest on interpretation, slowest on compilation (it takes more than 5 minutes to optimize them by llvm)12- `serialized-stdlib`13 - serializes standard library AST using serde14 - slower than `codegenerated-stdlib` at runtime, but have no compilation speed penality15- none16 - leaves only stdlib source code in binary, processing them same way as user supplied data17 - slowest (as it involves parsing of standard library source code)1819Because of `codegenerated-stdlib` compilation slowdown, `serialized-stdlib` is used by default2021### Benchmark2223Can also be run via `cargo bench`2425```markdown26# codegenerated-stdlib27test tests::bench_codegen ... bench: 401,696 ns/iter (+/- 38,521)28# serialized-stdlib29test tests::bench_serialize ... bench: 1,763,999 ns/iter (+/- 76,211)30# none31test tests::bench_parse ... bench: 7,206,164 ns/iter (+/- 1,067,418)32```3334## Intrinsics3536Some functions from stdlib are implemented as intrinsics3738### Intrinsic handling3940If indexed jsonnet object has field '__intrinsic_namespace__' of type 'string', then any not found field/method is resolved as `Val::Intrinsic(__intrinsic_namespace__, name)`crates/jrsonnet-evaluator/src/builtin/mod.rsdiffbeforeafterboth--- 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())),
})
}
crates/jrsonnet-evaluator/src/evaluate.rsdiffbeforeafterboth--- 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))
}
crates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth--- 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<str>, Rc<str>),
+ Intrinsic(Rc<str>, Rc<str>),
/// Library functions implemented in native
NativeExt(Rc<str>, Rc<NativeCallback>),
}
@@ -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<str> {
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!(),
}
}
crates/jrsonnet-stdlib/src/std.jsonnetdiffbeforeafterboth--- 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,