You would need dot overloading for that, which is scheduled for 0.6 
<https://github.com/JuliaLang/julia/issues/1974>, aka: planned, but don't 
hold your breath. 

I believe the general recommendation is to have accessor functions 
`get_x(f::Foo)` , `get_y(f::Foo)`, ideally with better names. Telling your 
users to access the fields of an object directly exposes internals and will 
prevent you from changing them in the future.

On Friday, May 27, 2016 at 6:52:17 PM UTC-4, Anonymous wrote:
>
> Is there a way to have an alias to a field name?  For instance suppose I 
> have
>
> type Foo
> x::Int
> end
>
> and I want to have Foo.y reference Foo.x, but I don't want an extra field 
> y in order to save memory.  Of course why not just have
>
> type Foo
> y::Int
> end
>
> instead?  Because I wan't the user to access a field using a different 
> name than the field name the programmer sees.. for reasons.
>

Reply via email to