tecosaur/About.jl

`about(Memory{Int})` fails

Closed this issue · 5 comments

julia> about(Memory{Int})
Concrete (padded) DataTypeERROR: Type GenericMemory does not have a definite size.
[...]

julia> about(Memory{Int}(undef, 0))
0-element Memory{Int64} (mutable), 0B referencing 16B (<: DenseVector{Int64} <: AbstractVector{Int64} <: Any)
ERROR: Type GenericMemory does not have a definite size.
[...]

I've just pushed 1305239, which makes the type not error. I'm open to providing a nice specialised display though.

julia> about(Memory{Int})
Concrete (padded) DataType defined in Core, 
  Memory{Int64} <: DenseVector{Int64} <: AbstractVector{Int64} <: Any

Struct with 2 fields:
• length  Int64       
• ptr     Ptr{Nothing}

fixing the memory value case will require some more thought.

Related bug: about(Memory{Int}()) errors.

Indeed,

fixing the memory value case will require some more thought.

😉

Doing the basic fixes can result in this:

0-element Memory{Int64} (mutable) (<: DenseVector{Int64} <: AbstractVector{Int64} <: Any)
 Memory footprint: 0B directly (referencing 16B in total)

but I do wonder if we could/should do something better.

I've now got a first attempt:

image

I think there's room for improvement, but it's good enough for an initial release.

Here we go, I've now got a second attempt:

image