# Julep: Efficient Hierarchical Mutable Data

**URL:** <https://discourse.julialang.org/t/julep-efficient-hierarchical-mutable-data/125190>\
**Category:** Internals & Design\
**Tags:** mutable-structure, rfc\
**Created:** [January 25, 2025, 6:51am UTC](https://discourse.julialang.org/t/julep-efficient-hierarchical-mutable-data/125190 "2025-01-25T06:51:04Z")\
**Posts on this page:** 1\
**Showing post:** 32

<div class="post-metadata">

**Author:** ![foobar\_lv2](https://avatars.discourse-cdn.com/v4/letter/f/ee59a6/32.png) [@foobar\_lv2](https://discourse.julialang.org/u/foobar_lv2)\
**Post date:** [January 29, 2025, 9:45am UTC](https://discourse.julialang.org/t/julep-efficient-hierarchical-mutable-data/125190/32 "2025-01-29T09:45:09Z")

</div>

Nice. However,

```julia
julia> f=BigForest(Elephant(1.0), Elephant(2.0), ""); f.elephant2.hunger
2.0

julia> typeof(f.elephant2)
ElephantView{:elephant2, BigForest}

julia> typeof(f.elephant2) == typeof(f.elephant1)
false

```

which brings up what I noted upthread:

> [@foobar\_lv2](#):
>
> The thing that makes this a new language feature is the desire that `typeof(fieldref(w::Whole, :part1)) === typeof(fieldref(w, :part2))`, i.e. that the type does not imply the offsets from the parent object.

I think this would really require new (albeit simple) core intrinsics relating to GC write barriers and a `very_unsafe_pointer_to_objref(typ::DataType, p::Ptr) = unsafe_pointer_to_objref(p)::typ` that assumes the type instead of checking (so UB instead of exception if it’s wrong, unless `check-bounds=yes`, or some compiler flag for the julia runtime is set).

---

_[View the full topic](https://discourse.julialang.org/t/julep-efficient-hierarchical-mutable-data/125190)._
