Way to add computed properties to a type?

Let’s say you have a type:

struct User
    first_name::AbstractString
    last_name::AbstractString
end

Is there a way to have a computed property called name on User that calls a function (and maybe caches it) using the following syntax:

User.name

// User.name |= User.first_name * " " * User.last_name

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

1 Like