79076243

Date: 2024-10-10 21:50:30
Score: 1
Natty:
Report link

"Is this a logical consequence of Smalltalk's syntax, or is it a consequence of Smalltalk's semantics and their execution?"

It is a consequnce of semantics--all parameters are passed with "In" (a.k.a. read-only) semantics. This applies to blocks and methods alike. Allowing "In Out" semantics would break encapsulation of the outer context(s).

Why then allow read-write access to the variables of the outer context? Same reason--because the outer context allows it, the inner context honors that expectation, except at the point of an explicit and manifest change, wherein the block header announces which variables are subject to its own encapsulation. Anything not mentioned there will not be affected.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Jim Sawyer