usually the alternative is a closure. But in your case, I would use:
    
    
    type Fighter = object
      phys: PhysicsComponent
    
    proc update(f: var Fighter) = update(f.phys)
    
    type Flyer = object
      phys: PhysicsComponent
    
    proc update(f: var Flyer) = update(f.phys)
    
    var
      flyers: seq[Flyer]
      fighers: seq[Fighter]
    
    for f in flyers: f.update
    for f in fighers: f.update
    

You can use templates and macros to fight the boilerplate. For example, you can 
use `macros.getType` in your update proc to iterate over the specific fields 
and call the component specific update procs. 

Reply via email to