I just implemented an "itexprs" and it gives:
@eval begin
type Test1
@itexprs 3:5 i->a_i::Int
end
end
names(Test1)
5-element Array{Symbol,1}:
:a_3
:a_4
:a_5
Is this not useful, in that I can now pass in any iterator not just a 1:N..
doesn't the above allow you to avoid collisions?
On Tue, Feb 11, 2014 at 1:42 PM, Tim Holy <[email protected]> wrote:
> On Monday, February 10, 2014 06:19:03 PM Fil Mackay wrote:
> > Nice one.. is there a @nexprs that can take a compile-time iterable, and
> > map function that produces a child expression for each item? Kind of like
> > replacing $N with "1:5" rather than one value at a time. That's what I'm
> > really looking for.
>
> No there isn't, and at the moment I don't see how it would be useful. In
> many
> circumstances you use a whole collection of cartesian macros together, and
> guessing how the different terms are supposed to be interleaved would be an
> exercise in mind-reading. For example, in this case, if @nexprs took a 1:5,
> you'd be trying to generate multiple fields named a_1 within a single type,
> which would obviously be an error.
>
> --Tim
>
>