Thanks for the thoughtful reply. The code you’ve written is exactly what I want to do, and at present I don’t see how my requirements could be achieved using multiple immutable instances. However, I’m also aware that I’m still coming to terms with Julia’s use of immutability and dynamic typing as an alternative to OOP, so what I say might be clouded by that. Here goes …
I’m trying to develop a new kind of genetic algorithm, and so I frequently need to generate 2-D tables of random numbers. To accelerate this generation, I create a singleton repository containing a table around five-times too big for current requirements, then generate the required table from random positions within the repository table.
Now, every so often, my GA needs a bigger table than anything used so far. In that case, I wish to reallocate the repository table in the new, bigger size. Also, occasionally I’ll want to reseed the repository table to shuffle the numbers a bit.
So: According to my current idea, the repository should be singleton, but containing an expandable table of random numbers. Alternative implementation ideas very gratefully received!