On Mon, Aug 8, 2016 at 3:57 AM, Andrei Zh <faithlessfri...@gmail.com> wrote:

> While parsing Julia expressions, I noticed that sometimes calls to
>

This shouldn't happen.


> global functions resolve to `GloablRef` and sometimes to
>

and GlobalRef should only happen during lowering.


> getfield(Module, func). Could somebody please clarify:
>
> 1. Why do we need both?
>

GlobalRef is essentially an optimization. It's more restricted and easier
to interpret/codegen and is emitted by lowering/type inference when it is
legal to do so.


> 2. Is it safe to replace one by the other (assuming only modules and
> functions are involved)?
>

Not always. There are certainly cases where a GlobalRef currently can't be
used (method definition for example) I'm not sure if there's cases the
other way around.

Reply via email to