I’m new to Julia, so first of alle hello
I’ve already searched for similar question, but couldn’t find any answer that would solve my specific question. Sorry if I’ve just overlooked it.
So, let’s say I have some material models and parameter, like this:
module MyAwesomeMaterials struct MaterialDataModel size elasticity resistance end ideal_material = MaterialDataModel(1, 33, 0) real_material_1 = MaterialDataModel(2, 100, 2) end
In truth, my data model consists of several structs with different constructors, and the actual instantiation is also rather involved (read: long), so I would like to split everything up into different files: One for the DataModel (the struct declarations so to say), and one file for each instance.:
From what I’ve read in other threads/question, the recommended way would be something like this: Create a module file
module MyAwesomeMaterials include('data_model.jl') include('ideal_material.jl') include('real_material_1.jl') end
and basically cut and paste everything up there into their respective files.
The problem that I have with this is that the instance-files (
ideal_material.jl, …) have no idea about the
struct-definitions. In particular, the IDE doesn’t have any information and can’t help me with code completion and stuff like this… In C/C++ I would have the data-model in a header-file, include it in every instance-file and protect from multiple including via
What is the most julia-idiomatic way to organize codes like this?
Thanks in advace and best,