@dallaylaen/ski-interpreter 2.5.2 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -679,35 +679,48 @@ export declare class Alias extends Named {
679
679
  /**
680
680
  * @desc A named alias for an existing expression.
681
681
  *
682
- * Upon evaluation, the alias expands into the original expression,
683
- * unless it has a known arity > 0 and is marked terminal,
684
- * in which case it waits for enough arguments before expanding.
682
+ * Aliasing allows declaring new terms without a native implementation.
683
+ * This is what happens when one writes `B = S(KS)K` in the interpreter.
684
+ *
685
+ * Aliases are transparent in terms of `equals` and `expect`;
686
+ * for that reason, Alias.diag() in not adding to the indentation.
687
+ *
688
+ * Aliases have an `inline` property. Tf true, the alias will be replaced with its implementation
689
+ * everywhere, unless specifically told otherwise e.g. by { inventory: { ... } } option of format().
690
+ *
691
+ * Upon creation, the aliases arity is calculated (unless `canonize` is false).
692
+ *
693
+ * Upon evaluation, the alias will be replaced with its implementation,
694
+ * _unless_ it's not inline and has positive arity,
695
+ * in which case it will wait for the required number of arguments before such replacement.
685
696
  *
686
- * A hidden mutable property 'outdated' is used to silently
687
- * replace the alias with its definition in all contexts.
688
- * This is used when declaring named terms in an interpreter,
689
- * to avoid confusion between old and new terms with the same name.
690
697
  *
691
698
  * @param {String} name
692
699
  * @param {Expr} impl
693
- * @param {{canonize?: boolean, max?: number, maxArgs?: number, note?: string, terminal?: boolean}} [options]
700
+ * @param {{canonize?: boolean, max?: number, maxArgs?: number, note?: string, inline?: boolean}} [options]
694
701
  */
695
- terminal?: boolean;
696
702
  impl: Expr;
697
- outdated?: boolean;
703
+ inline?: boolean;
698
704
  constructor(name: string, impl: Expr, options?: {
699
705
  canonize?: boolean;
700
706
  max?: number;
701
707
  maxArgs?: number;
702
708
  note?: string;
703
- terminal?: boolean;
704
- outdated?: boolean;
709
+ inline?: boolean;
705
710
  });
706
711
  /**
707
- * @property {boolean} [outdated] - whether the alias is outdated
708
- * and should be replaced with its definition when encountered.
709
- * @property {boolean} [terminal] - whether the alias should behave like a standalone term
710
- * // TODO better name?
712
+ * @desc Make the alias inline, i.e. replace it with its implementation everywhere.
713
+ *
714
+ * Replaces the old `outdated` attribute.
715
+ * Used by the parser when a term definition is removed or updated.
716
+ *
717
+ * May change in future versions, use with caution.
718
+ *
719
+ * @experimental
720
+ * @returns {this}
721
+ */
722
+ makeInline(): this;
723
+ /**
711
724
  * @property {boolean} [proper] - whether the alias is a proper combinator (i.e. contains no free variables or constants)
712
725
  * @property {number} [arity] - the number of arguments the alias waits for before expanding
713
726
  * @property {Expr} [canonical] - equivalent lambda term.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dallaylaen/ski-interpreter",
3
- "version": "2.5.2",
3
+ "version": "2.6.0",
4
4
  "description": "Simple Kombinator Interpreter - a combinatory logic & lambda calculus parser and interpreter. Supports SKI, BCKW, Church numerals, and setting up assertions ('quests') involving all of the above.",
5
5
  "keywords": [
6
6
  "combinatory logic",