Yeah, I've been thinking about this – and I'm actually using it for one of 
my fields at the moment. Some of the other fields have type parameters 
themselves, such as NTuples with lengths, etc., so this would be a 
two-level thing, then. I couldn't supply the size of a  tuple in this type 
if there is no declared tuple – i.e., if that comes in as a parameter. (On 
a side note, I could ensure that the relevant type parameter would be a 
subtype of NTuple of the given size, I guess.)

There's also the issue of checking that the fields have the right type – 
*if* they're present. (Also doable, of course.)

Now, I might not want to keep it all immutable – but I guess I could live 
with/work with that.

However … one reason I was a bit wary of going all-out on this was that 
despite my intuition, which coincides with your statements above, Julia 
does *not* report zero size for Nothing. If I instantiate your type above, 
for example, with only nothing-parameters, sizeof() reports a size of 40. I 
guess this is "canonical", and that it'll be optimized away – but why 
doesn't sizeof() report 0, I wonder?

Reply via email to