Indeed, here's a macro I made to do this!

<https://gist.github.com/exelotl/1f387c47468d02be4587044ed270c907>

Example:
    
    
    type
      Vec2 = object
        x, y: float
      Player = object
        position: Vec2
    
    compose Player, position
    
    var p: Player
    p.y += 20
    p.x = p.y + 10
    
    echo p.x   # 30
    echo p.y   # 20
    
    
    Run

Reply via email to