# \#ref

**URL:** https://discourse.julialang.org/tag/ref/1229.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Why does RefValue has allocation?](https://discourse.julialang.org/t/why-does-refvalue-has-allocation/135720)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 7\
**Last updated:** [February 20, 2026, 8:57am UTC](https://discourse.julialang.org/t/why-does-refvalue-has-allocation/135720 "2026-02-20T08:57:44Z")

</div>

How to explain that only by adding one line r\[\] I had one more allocation? I don’t understand. You can neglect the packages, just focus on the function \_grbval and grbval, and r. Thanks. import JuMP, Gurobi \_grbval(o, …

---

## [\[ANN\]: ZeroDimensionalArrays.jl: zero-dimensional arrays/references/boxes](https://discourse.julialang.org/t/ann-zerodimensionalarrays-jl-zero-dimensional-arrays-references-boxes/128002)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 24\
**Last updated:** [October 15, 2025, 3:33pm UTC](https://discourse.julialang.org/t/ann-zerodimensionalarrays-jl-zero-dimensional-arrays-references-boxes/128002 "2025-10-15T15:33:59Z")

</div>

ZeroDimensionalArrays.jl is being registered, meaning it has entered the three-day-long wait period. Feel free to suggest breaking changes until the wait period is over! It’s a tiny package, implementing several similar…

---

## [Why is Ref() not reflecting the changes](https://discourse.julialang.org/t/why-is-ref-not-reflecting-the-changes/130740)

<div class="topic-metadata">

**Author:** [@Farouk](https://discourse.julialang.org/u/Farouk)\
**Replies:** 2\
**Last updated:** [July 15, 2025, 1:57pm UTC](https://discourse.julialang.org/t/why-is-ref-not-reflecting-the-changes/130740 "2025-07-15T13:57:41Z")

</div>

Hello I am playing with the Ref{T} and I cannot understand why when doing some updates the changes are visible via the variable holding the Ref and when doing other updates they don’t show up. I would appreciate your hel…

---

## [Copy on write?](https://discourse.julialang.org/t/copy-on-write/126021)

<div class="topic-metadata">

**Author:** [@iago-lito](https://discourse.julialang.org/u/iago-lito)\
**Replies:** 2\
**Last updated:** [February 18, 2025, 5:19pm UTC](https://discourse.julialang.org/t/copy-on-write/126021 "2025-02-18T17:19:17Z")

</div>

Hello Julia, I need copy-on-write behaviour to protect fields of the large values I’m handing out to my users from cluttering their memory with useless copies. Is there such thing as a julia Cow{T} akin to rust’s Cow\<T\>…

---

## [Package Development: Why is Ref needed to pass a global constant to a function?](https://discourse.julialang.org/t/package-development-why-is-ref-needed-to-pass-a-global-constant-to-a-function/122566)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 13\
**Last updated:** [November 15, 2024, 7:47pm UTC](https://discourse.julialang.org/t/package-development-why-is-ref-needed-to-pass-a-global-constant-to-a-function/122566 "2024-11-15T19:47:05Z")

</div>

I currently have the following setup (which works great) but somehow seems inelegant: src/MyPackage.jl module MyPackage include("mysrc.jl") const CONFIG = Ref{Config}() end src/mysrc.jl @with\_kw struct Config a :…

---

## [How is \`deepcopy\` so clever regarding aliasing and self-reference?](https://discourse.julialang.org/t/how-is-deepcopy-so-clever-regarding-aliasing-and-self-reference/113235)

<div class="topic-metadata">

**Author:** [@iago-lito](https://discourse.julialang.org/u/iago-lito)\
**Replies:** 4\
**Last updated:** [April 19, 2024, 1:43pm UTC](https://discourse.julialang.org/t/how-is-deepcopy-so-clever-regarding-aliasing-and-self-reference/113235 "2024-04-19T13:43:10Z")

</div>

I find this behaviour very fortunate, but also black magic: a = \[5\] u = \[a, a, a\] v = deepcopy(u) v\[1\]\[1\] = 8 v # \[\[8\], \[8\], \[8\]\] # My naive 'deepcopy' would have produced \[\[8\], \[5\], \[5\]\] instead. I expected deepcopy …

---

## [Parametric Type for Uninitialized/Undef Objects](https://discourse.julialang.org/t/parametric-type-for-uninitialized-undef-objects/91543)

<div class="topic-metadata">

**Author:** [@uniment](https://discourse.julialang.org/u/uniment)\
**Replies:** 0\
**Last updated:** [December 12, 2022, 6:06am UTC](https://discourse.julialang.org/t/parametric-type-for-uninitialized-undef-objects/91543 "2022-12-12T06:06:47Z")

</div>

I’ve learned that you can create type-stable references to uninitialized objects like so: julia\> struct Foo{A} a::A end julia\> x = Ref{Foo{Int}}() Base.RefValue{Foo{Int64}}(Foo{Int64}(1847082903376)) julia\> x\[\] = Foo(…
