What problem are you trying to solve here?

On Wed, May 25, 2016 at 9:12 AM, Yichao Yu <[email protected]> wrote:

> On Wed, May 25, 2016 at 9:04 AM, Ford Ox <[email protected]> wrote:
> > I have just realized that
> > x =5
> > array[x]
> > won't work...
> >
> > I see two possible workarounds:
> >
> > If the symbol has nothing to do with the structure you are operating
> with,
> > you eval that symbol.
>
> You can never tell and calling eval in macro is almost never correct
> (it is only ok with a lot of care for macros that is only supposed to
> be used at toplevel),
>
> > You use @generated setindex(..)  instead and if you want to access the
> great
> > features like collection[first] colleaction[last], you will have to do
> this
> > instead:
> > collection[:first]
> > collection[:last]
>
> FWIW, this has nothing to do with lowering.
> :first, :end won't work either since they are of the same type.
> A similar but possibly working approach is
> https://github.com/JuliaLang/julia/pull/15750. The immediate issue
> with this class of approach is the support for arithmetics.
>
> >
> > I guess the second option is better, and it might already work ( I can't
> > check since julia box throws error whenever I use @generated)...
> >
>

Reply via email to