[squeak-dev] The Inbox: MorphicExtras-dtl.214.mcz

K K Subbu kksubbu.ml at gmail.com
Wed Nov 15 14:32:14 UTC 2017


On Wednesday 15 November 2017 01:06 AM, Chris Muller wrote:
> I see Dynamic vars as similar to globals in terms of being a
> read/write free-for-all, not scoped by the code structure, but by
> runtime conditions as well, which imposes an even greater cognitive
> load on the reader than a simple global.  I know they have their
> use-case, but besides that, I do hope we'll steer clear of introducing
> any more DynamicVars into the base code.

Dynamic vars (like the keywords self and super) have their uses, 
particularly when working with sensors.

Using variables like "Now" is more readable than "DateAndTime now 
ticks". There should a facility in base code to tag such variables as 
aliases.

E.g.

   AliasBuilder new:#World for: [Project current world]

   AliasBuilder new:#Now for: [DateAndTime now ticks]

The compiler can then replace every reference to Now with:

   ([AliasBuilder lookup:#Now] value)

Regards .. Subbu


More information about the Squeak-dev mailing list