Duke,
To use the re-declared pi, you just cite it in an expression as normal. The new declaration overrides the earlier one in the subsequent code, but as you are aware, the references to pi prior to the redeclaration remain bound to the original declaration, as in the following example:
val x = 99;
val x = 99: int
x + 22;
val it = 121: int
val x = 100;
val x = 100: int
x + 22;
val it = 122: int
Regards,
Rob
On 24 Jan 2026, at 16:20, Duke Normandin sidney.reilley.ii@gmail.com wrote:
I think that I almost understand "shadowing", maybe ...
val pi = 3.14159; fun area (r) = pi*r*r; area 2.0; => 12.56636
So far so good ...
re-declare pi ... val p1 = 0.0;
Here is where things get blurry for me. When/how is the *new* pi available? Is it only available if re-declared in a *block* of code, making it local to that block and therefore usable there and only there?
After re-declaring pi above, executing the "area" function uses the original pi.
I get that!
What I'm not sure of is how to use the re-declared pi. TIA ...
-- Duke _______________________________________________ Poly/ML mailing list -- polyml@lists.polyml.org To unsubscribe send an email to polyml-leave@lists.polyml.org