# Getproperty, decorations, inheritance in 0.7

**URL:** https://discourse.julialang.org/t/getproperty-decorations-inheritance-in-0-7/11237
**Category:** General Usage
**Created:** [May 29, 2018, 2:48pm UTC](https://discourse.julialang.org/t/getproperty-decorations-inheritance-in-0-7/11237 "2018-05-29T14:48:27Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [May 30, 2018, 9:27pm UTC](https://discourse.julialang.org/t/getproperty-decorations-inheritance-in-0-7/11237/14 "2018-05-30T21:27:03Z")

</div>

> [@StefanKarpinski](#):
>
> Therefore `Val{x}` is unnecssary on 0.7 since the hint is no longer needed in order to coax the optimizer into specializing on `x` : it will do so automatically where possible and the `Val` wrapper doesn’t magically make it any easier to do so.

How about if I want to dynamically specialise on a certain value?

```julia
using StaticArrays

function f(n::Int)
    b = rand(SVector{n})
    for i in 1:10000
        b += rand(SVector{n})
    end
    return b
end

function f(_n::Val{n}) where n
    b = rand(SVector{n})
    for i in 1:10000
        b += rand(SVector{n})
    end
    return b
end

g1() = f(rand(4:4))
g2() = f(Val(rand(4:4)))

@time g1()
@time g2()

```

```julia
julia> @time g1();
  0.015060 seconds (140.02 k allocations: 8.851 MiB)

julia> @time g2();
  0.000249 seconds (5 allocations: 208 bytes)

```

---

_[View the full topic](https://discourse.julialang.org/t/getproperty-decorations-inheritance-in-0-7/11237)._
