See: https://github.com/JuliaLang/julia/issues/8156

kl. 14:03:55 UTC+2 onsdag 27. august 2014 skrev Ivar Nesje følgende:
>
> Sorry, I seem to have been wrong. Nothing/nothing works that way with 
> arrays, so I assumed it worked the same way with types. It seems like it 
> does not and uses a lower bound of 8 for empty immutables.
>
> It is probably simple to fix, I'll open an issue.
>
> Ivar
>
> kl. 13:29:48 UTC+2 onsdag 27. august 2014 skrev Magnus Lie Hetland 
> følgende:
>>
>> 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