On Wed, Dec 16, 2015 at 10:11 AM, Jon Norberg <[email protected]> wrote: > Is it possible to dynamically create a composite type if I have a list of > strings for the fieldnames? > > Is it possible to do this in a function? > > A=[] > push!(A,"X") > push!(A,"Y") > push!(A,"Z") > > function defineCompositeType(A) > magic? > end
Types can only be defined at top levels so you need `eval` Try `xdump(:(type T X; Y; X; end))` to see the AST you want to construct. > > regards, Jon
