On Mon, Aug 17, 2015 at 7:55 PM, James Aguilar <
aguila...@gmail.com> wrote:
>
> I can think of a lot of different reasons, but I'm not sure which one is the
> one the go authors have decided has the most merit. The main reasons I
> thought were:
>
> 1. People think of functions as proceeding forward, thus we will impart that
> semantic behavior on types declared in a function, whether it's necessary or
> not. In other words, we have to choose whether we're being inconsistent with
> "functions move forward" or "types can be declared in arbitrary order," and
> we chose to be inconsistent with the latter.
> 2. As an opinionated way to discourage users from making complicated type
> graphs in functions?
> 3. So that the same dependency code can be used for all statements and
> declarations within a function -- even in types where it is not strictly
> necessary. In other words, as a way to reduce toolchain code complexity.
>
> But I don't know which of these, or another option, is actually right. Could
> we get a hint? Particularly, is there a case I haven't thought of where it
> is actually not possible to ignore the order of types declared in a
> function?
declarations did not occur in declaration order. Each var and const
the function. Any initialization in a var statement occurs in
declaration order. I think anything else would be quite confusing.
also be defined in declaration order. Type declarations look very
much like var declarations. Having them be different within a