# \#setfield

**URL:** https://discourse.julialang.org/tag/setfield/656.md

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

---

## [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…

---

## [Field insertion in immutable @with\_kw struct](https://discourse.julialang.org/t/field-insertion-in-immutable-with-kw-struct/72373)

<div class="topic-metadata">

**Author:** [@alequa](https://discourse.julialang.org/u/alequa)\
**Replies:** 2\
**Last updated:** [December 1, 2021, 1:10pm UTC](https://discourse.julialang.org/t/field-insertion-in-immutable-with-kw-struct/72373 "2021-12-01T13:10:37Z")

</div>

Hi, I am trying to load a @with\_kw struct from a named tuple, but I cannot find a way to associate the fields correctly. I would like to use something like a split operator, but the split operator on a named tuple retu…

---

## [Setfield.jl for parametric type](https://discourse.julialang.org/t/setfield-jl-for-parametric-type/71670)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 0\
**Last updated:** [November 17, 2021, 4:05pm UTC](https://discourse.julialang.org/t/setfield-jl-for-parametric-type/71670 "2021-11-17T16:05:55Z")

</div>

struct B{T, X, Y} x::X y::Y end B{T}(x::X, y::Y = 2) where {T, X, Y} = B{T, X, Y}(x, y) b = B{Int}(2,3) Setfield.@set b.x = 512 # fails

---

## [Accessing struct via Symbol](https://discourse.julialang.org/t/accessing-struct-via-symbol/58809)

<div class="topic-metadata">

**Author:** [@mrVeng](https://discourse.julialang.org/u/mrVeng)\
**Replies:** 5\
**Last updated:** [April 8, 2021, 11:00am UTC](https://discourse.julialang.org/t/accessing-struct-via-symbol/58809 "2021-04-08T11:00:28Z")

</div>

Dear all, Is there a reason why this works: struct Test1{A, B} a :: A b :: B end test1 = Test1(1., 2.) test1.:a #1 but this does not work? \_a = :a test1.\_a # type Test1 has no field \_a In my case I would like to u…
