Richard,
Question from someone still fairly new to Smalltalk:
To implement the example you gave regarding mutually recursive functions in
Lua, one must write something like this:
�� ��local f, g
�� ��function g ()
�� �� ��<do something>
�� �� ��f()
�� �� ��<do something>
�� ��end
�� ��function f ()
�� �� ��<do something>
�� �� ��g()
�� �� ��<do something>
�� ��end
where the initial declaration of f & g as locals defines an f such that g
will see it (as a local, albeit containing nil) when g is defined.�� The
following definition of f doesn't require this, of course.�� And g doesn't
care what f contains -- until execution time.
Both Lua and Smalltalk implement full lexical closures, so it begs the
question: Do the blocks defined in your example have this same issue?�� What
is 'g' in the block assigned to f?
Is it required that 'g' be lexically defined prior to referencing it in a
block closure, or does Smalltalk have a mechanism to resolve this at
execution time?
Thanks,
-Ted
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html