AngouriMath

Navigation

Binding


← Back to list of classes

Description

Summary

The name a binder is handed, and what that name means inside it.

Remarks

Two kinds of name need reading rather than taking as they arrive, and they arrive from
opposite directions. i is the imaginary unit and that is decided in the lexer —
NUMBER: ... | 'i' — so it never reaches the rule that makes variables and is a
number in the name position. e and pi are Constants,
which are Variables by inheritance and separate objects by identity, so the
name position holds a constant and what is bound must be the variable of that name.
Either way the answer is the same: the binder decides what its name means, once, here.
#976,
#984
Naming i as the bound name says something about the whole binder, so it is
honoured throughout it — through the summand and the bounds, not only in the name
position. Doing it in the name position alone would be worse than not doing it at all:
the index would become a variable while every i beside it stayed the imaginary
unit, nothing would substitute, and sum(i, i, 1, 10) would answer 10i instead of 55 — a wrong answer in place of an unevaluated one.
Only inside the binder that declares it. sum(i * k, k, 1, 3) is 6i, and the
i outside the sum in sum(i, i, 1, 3) + i is still the imaginary unit.
This is a struct holding two fields and it is the whole cost of the
feature where nothing is shadowed: Of(AngouriMath.Entity) is two type tests that both
fail, and In(AngouriMath.Entity) hands the expression straight back without walking it.

Members

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4378 pages online