What is the difference between fields and properties in Julia? : <p>Julia has the setter functions <code>setproperty!</code> and <code>setfield!</code> and the getter functions <code>getproperty</code> and <code>getfield</code> that operate on structs. What is the difference between properties and fields in Julia?</p>

<p>For example, the following seems to indicate that they do the same thing:</p>

<pre><code>julia&gt; mutable struct S
           a
       end

julia&gt; s = S(2)
S(2)

julia&gt; getfield(s, :a)
2

julia&gt; getproperty(s, :a)
2

julia&gt; setfield!(s, :a, 3)
3

julia&gt; s
S(3)

julia&gt; setproperty!(s, :a, 4)
4

julia&gt; s
S(4)
</code></pre>
