pointerof

    1. class Point
    2. def initialize(@x : Int32, @y : Int32)
    3. end
    4. def x
    5. def x_ptr
    6. pointerof(@x)
    7. end
    8. ptr = point.x_ptr
    9. ptr.value = 10
    10. point.x # => 10