// Feature: dyn Trait trait objects
//
//   spanda check examples/features/dyn_trait_object.sd
//   spanda run examples/features/dyn_trait_object.sd

trait Greeter {
  fn greet() -> Void;
}

robot TraitObjectRover {
  actuator wheels: DifferentialDrive;

  agent Nav {
    tools [wheels];
    goal "Greet safely";
    plan { wheels.stop(); }
  }

  impl Greeter for Nav {
    fn greet() -> Void {
      // Description:
      //     Performs a safe greet by stopping wheel motion.
      //
      // Inputs:
      //     None.
      //
      // Outputs:
      //     None.
      //
      // Example:
      //     handler.greet();
      wheels.stop();
    }
  }

  behavior run() {
    let handler: dyn Greeter = Nav;
    handler.greet();
  }
}
