# Way to add computed properties to a type?

**URL:** https://discourse.julialang.org/t/way-to-add-computed-properties-to-a-type/7094
**Category:** General Usage
**Tags:** question
**Created:** [November 16, 2017, 5:23am UTC](https://discourse.julialang.org/t/way-to-add-computed-properties-to-a-type/7094 "2017-11-16T05:23:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![djsegal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djsegal/32/13752_2.png) [@djsegal](https://discourse.julialang.org/u/djsegal)
#### Post date: [November 16, 2017, 5:23am UTC](https://discourse.julialang.org/t/way-to-add-computed-properties-to-a-type/7094/1 "2017-11-16T05:23:10Z")

</div>

Let’s say you have a type:

```julia
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:

```julia
User.name

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

```

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [November 16, 2017, 6:01am UTC](https://discourse.julialang.org/t/way-to-add-computed-properties-to-a-type/7094/2 "2017-11-16T06:01:41Z")

</div>

[https://github.com/JuliaLang/julia/issues/1974](https://github.com/JuliaLang/julia/issues/1974)
