Defining a struct in a different module


#1

Hi i would like to do the following:


module DDF
end

struct DDF.XX
end

is there a way to do this?

Thanks


#2

see below


#3

The first argument to @eval or eval is the module in which you want evaluation to take place. So you actually can do what you’re asking for:

julia> module Foo; end
Foo

julia> @eval Foo struct Bar; end

julia> Foo.Bar()
Foo.Bar()

#4

thanks – it turns out I have a use for this :slight_smile: