In Julia, variables have types, and the compiler uses this information to generate optimized code. The Python pattern of adding a variable or field at run-time is thus uncommon in Julia.
A straightforward translation of the Python pattern would be to use a dictionary. (In Python, objects are implicitly dictionaries; in Julia, that's not the case.) You can then easily check whether the dictionary holds a particular key, and update the dictionary if not. You would probably want to use a symbol as key (e.g. ":x", without the quotes). -erik On Mon, Jan 25, 2016 at 9:46 AM, <[email protected]> wrote: > Ok so basically what I want to do is impossible. > I could remove the encapsulation inside the main() function I guess, but > it's not ideal either. -- Erik Schnetter <[email protected]> http://www.perimeterinstitute.ca/personal/eschnetter/
