I do wish people wouldn't say "beg the question"
https://grammarist.com/rhetoric/begging-the-question-fallacy/
when they mean "invites" or "raises" the question. Sigh.

Yes, Smalltalk is just like Lua here.
  |f g|  "declare f and g as local variables"
  f := [... g value ...]. "f uses g's current value"
  g := [... f value ...]. "g uses f's current value"

You cannot mix declarations and statements in Smalltalk.
Local variables have to be declared before use.


On Thu, 16 May 2019 at 11:31, Brainstorms <wild.id...@gmail.com> wrote:

> 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
>
>

Reply via email to