>
> dylex sent you a message.
>
> --------------------
> Subject: Define local (and global) function/variable scoping/
> recursion rules [girving/duck GH-30]
>
> There are many possibilities for block assignment semantics.
> Ideally I would like expression blocks and the top level to
> basically follow the same rules (possibly modulo overloading). With
> most options there is a problem of premature variable references,
> before they're assigned. Basically they can be treated as if they
> are void or don't exist, much as we do now.
Your last sentence appears to solve the problem, so no more problems?
> One extreme is that no shadowing is allowed and everything has scope
> everywhere. This could potentially make for very prickly code. The
> other extreme is that everything has scope strictly downwards,
> except for consecutive function definitions which also have scope
> within their group (for mutual recursion). This eliminates the
> premature reference issue, but is rather restrictive.
Let's allow shadowing since we both like it.
> My current proposal is this:
> * Functions are arbitrarily recursive and all are in scope
> throughout their block. Multiple definitions are overloads or
> illegal.
Agreed.
> * Variables have scope strictly downward. Shadowing is allowed
> accordingly.
Agreed.
> In this case, premature references are always indirect (variable 1
> calls function 3 refs variable 2; variable 2 calls function 1 calls
> function 4 refs variable 3).
>
> View this Issue online: http://github.com/girving/duck/issues#issue/30
> --------------------
>
> Reply on GitHub: http://github.com/inbox/247250#reply