Not yet. Maybe for 0.5?

https://github.com/JuliaLang/julia/issues/1974


On Saturday, August 15, 2015 at 7:35:20 PM UTC-7, Dominique Orban wrote:
>
> I'm wondering if implementing getfield() / setfield!() for a composite 
> type could be a good design for getters and setters. Say I have a type
>
> type Thing
>  a :: Int
>  b :: int
> end
>
> where I'm requiring the `a` field to be even. It'd be great to be able to 
> type
>
> thing = Thing()
> thing.a = 3
>
> and receive an error.
>
> In 0.3.10 and 0.4, I can't implement setfield!(): 
> ERROR: cannot define function setfield!; it already has a value.
>
> Is there a way to do this?
>

Reply via email to