method dispatch on the object type does a remarkably good job at providing this functionality without needing a specialized feature:
static_data(::Type{MyObj}) = 1 static_data(::Type{MyOtherObj}) = 2 On Wed Dec 31 2014 at 8:23:40 PM Josh Langsfeld <jdla...@gmail.com> wrote: > I currently am trying to solve a problem where I have many composite types > and I would like to associate some data with each type, such that every > instance has access to it. Obviously, in C++ I would just create a static > member variable. > > Is there a good way to go about this in Julia? Currently, I have it > working by using a global Dict mapping DataType objects to their associated > data but I really don't like this. Something more naive like just adding > that field to every object instance also strikes me as unnecessary and > wasteful. I haven't seen any significant discussion about static fields on > the lists or on github so is this something that could be considered for > addition to the language? > > Thanks, > Josh >