# \#accessors

**URL:** https://discourse.julialang.org/tag/accessors/1190.md

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

---

## [Modifying subentries in a Vector{SVector}, @set and reinterpret](https://discourse.julialang.org/t/modifying-subentries-in-a-vector-svector-set-and-reinterpret/130178)

<div class="topic-metadata">

**Author:** [@eldee](https://discourse.julialang.org/u/eldee)\
**Replies:** 1\
**Last updated:** [June 24, 2025, 7:41pm UTC](https://discourse.julialang.org/t/modifying-subentries-in-a-vector-svector-set-and-reinterpret/130178 "2025-06-24T19:41:58Z")

</div>

Hi, Most of the time it makes conceptually more sense to store some data as a Vector{SVector{Float64, 3}} v as opposed to a Matrix{Float64} M of size (3, n). However, this makes updating (sub)entries more difficult. I.…

---

## [Shorter way to rename property, with Accessors](https://discourse.julialang.org/t/shorter-way-to-rename-property-with-accessors/127256)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 16\
**Last updated:** [March 23, 2025, 8:51pm UTC](https://discourse.julialang.org/t/shorter-way-to-rename-property-with-accessors/127256 "2025-03-23T20:51:47Z")

</div>

How to do rename with Accessors? This is too long. julia\> let x = (;a=1) @delete (@insert x.b = x.a).a end (b = 1,)

---

## [Why are concatenated String15's promoted to String31?](https://discourse.julialang.org/t/why-are-concatenated-string15s-promoted-to-string31/124686)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 2\
**Last updated:** [January 12, 2025, 12:27am UTC](https://discourse.julialang.org/t/why-are-concatenated-string15s-promoted-to-string31/124686 "2025-01-12T00:27:11Z")

</div>

I found this bug (I guess it is mine) when trying to @reset an element of an SVector{String15} after updating Accessors from 0.1.38 to 0.1.39, but not sure why it used to work. MWE: julia\> using InlineStrings julia\> x…

---

## [Any way to skip a constructor for Accessors.jl-like syntax?](https://discourse.julialang.org/t/any-way-to-skip-a-constructor-for-accessors-jl-like-syntax/122678)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 3\
**Last updated:** [November 15, 2024, 3:24pm UTC](https://discourse.julialang.org/t/any-way-to-skip-a-constructor-for-accessors-jl-like-syntax/122678 "2024-11-15T15:24:45Z")

</div>

So this internal :new expression seems to be working again. I’m wondering if it’s possible to unsafely skip inner constructors’ validation to instantiate tweaks to existing instances with setting syntax like Accessors.jl…

---

## [Efficiently creating and updating a struct of SVectors](https://discourse.julialang.org/t/efficiently-creating-and-updating-a-struct-of-svectors/119697)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 10\
**Last updated:** [September 23, 2024, 7:58pm UTC](https://discourse.julialang.org/t/efficiently-creating-and-updating-a-struct-of-svectors/119697 "2024-09-23T19:58:17Z")

</div>

Part A I’m reading some data in from a file then storing it in a struct looking something like this: # "Big" struct of SVectors @with\_kw struct BigStruct{N} A :: SVector{N, Int16} B :: SVector{N, Int16} C :…

---

## [SVectors + @reset from Accessors: Strange Benchmarks](https://discourse.julialang.org/t/svectors-reset-from-accessors-strange-benchmarks/119201)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 31\
**Last updated:** [September 13, 2024, 3:00pm UTC](https://discourse.julialang.org/t/svectors-reset-from-accessors-strange-benchmarks/119201 "2024-09-13T15:00:53Z")

</div>

Full MWE: MWEusing StaticArrays, Parameters, Accessors, BenchmarkTools # Test Functions function loop1(dat) for t in 1:10 for i in eachindex(dat) @reset dat\[i\].A .+= dat\[i\].B end end…

---

## [CUDA/GPU compatible discretization from MethodOfLines.jl](https://discourse.julialang.org/t/cuda-gpu-compatible-discretization-from-methodoflines-jl/106506)

<div class="topic-metadata">

**Author:** [@NonDairyNeutrino](https://discourse.julialang.org/u/NonDairyNeutrino)\
**Replies:** 2\
**Last updated:** [November 21, 2023, 7:46pm UTC](https://discourse.julialang.org/t/cuda-gpu-compatible-discretization-from-methodoflines-jl/106506 "2023-11-21T19:46:03Z")

</div>

MethodOfLines.jl (MOL) exports discretize which gives an ODEProblem that can then be directly passed to OrdinaryDiffEq.solve() to get a solution. This works great if you want a CPU evaluation, but it seems not so much i…

---

## [Getter function naming: Consider avoiding nouns](https://discourse.julialang.org/t/getter-function-naming-consider-avoiding-nouns/101832)

<div class="topic-metadata">

**Author:** [@stemann](https://discourse.julialang.org/u/stemann)\
**Replies:** 2\
**Last updated:** [July 20, 2023, 12:53pm UTC](https://discourse.julialang.org/t/getter-function-naming-consider-avoiding-nouns/101832 "2023-07-20T12:53:37Z")

</div>

I am (heavily) considering judging using nouns for (exported) getter accessor functions bad practice. I’ve found myself writing structs with getter accessors named equal to the names of the fields they are getting, i.e.…

---

## [Replace Vector at indices and return a copy](https://discourse.julialang.org/t/replace-vector-at-indices-and-return-a-copy/90692)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 9\
**Last updated:** [November 23, 2022, 10:28am UTC](https://discourse.julialang.org/t/replace-vector-at-indices-and-return-a-copy/90692 "2022-11-23T10:28:18Z")

</div>

What’s the easiest way to return a copy of a Vector with replaced elements at some indices with some specific values ? I can start with one approach: julia\> v = \[10,20,30,40,50\]; julia\> inds = \[2,5\]; julia\> vals = \[2…

---

## [Container of mutable structs without 100x slowdown?](https://discourse.julialang.org/t/container-of-mutable-structs-without-100x-slowdown/86629)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 7\
**Last updated:** [September 1, 2022, 12:03pm UTC](https://discourse.julialang.org/t/container-of-mutable-structs-without-100x-slowdown/86629 "2022-09-01T12:03:08Z")

</div>

It seems like when mutable structs are stored in any kind of container, Julia is unable to optimize them onto the stack or even to a packed buffer on the heap. It always allocates new memory on the heap for each individ…

---

## [Mutating a dictionary through aliases](https://discourse.julialang.org/t/mutating-a-dictionary-through-aliases/86378)

<div class="topic-metadata">

**Author:** [@danielsoutar](https://discourse.julialang.org/u/danielsoutar)\
**Replies:** 4\
**Last updated:** [August 26, 2022, 8:40pm UTC](https://discourse.julialang.org/t/mutating-a-dictionary-through-aliases/86378 "2022-08-26T20:40:28Z")

</div>

Let’s say I have a dictionary like so: my\_object = Dict{Symbol, Any}( :foo =\> Dict{Symbol, Any}( :foo\_items =\> \["item\_a", "item\_b", "item\_c"\], :bar =\> Dict{Symbol, Any}( :bar\_name =\> \["na…

---

## [Replace date year](https://discourse.julialang.org/t/replace-date-year/68301)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 22\
**Last updated:** [September 19, 2021, 9:21pm UTC](https://discourse.julialang.org/t/replace-date-year/68301 "2021-09-19T21:21:13Z")

</div>

d = Date(2010,01,01) How can I replace the year with 2011?

---

## [I don't see any caveats in \`Setfield.jl / Accessors.jl\`, but I'm getting a method](https://discourse.julialang.org/t/i-dont-see-any-caveats-in-setfield-jl-accessors-jl-but-im-getting-a-method/54657)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 3\
**Last updated:** [February 5, 2021, 7:59am UTC](https://discourse.julialang.org/t/i-dont-see-any-caveats-in-setfield-jl-accessors-jl-but-im-getting-a-method/54657 "2021-02-05T07:59:25Z")

</div>

I don’t see any caveats in Setfield.jl / Accessors.jl, but I’m getting a method error (ERROR: LoadError: MethodError: no method matching) for the constructor that I’m trying to mutate. Are limitations outlined anywhere? …
