What's the difference between controller first and choice first?

Hi @anthony, there are two differences:

  1. The controller x can syntax implicitly adds x to the list of observers. For the second syntax, you have to add x to the list of observers separately.
  2. The second form is more general. Specifically, the controller expression can refer to the fields of your choice argument. You make use of that in your example above: The controller signer is only introduced by the choice argument. With the controller … can syntax, the controller expression can only refer to the fields of the template so you will get an error if you try to rephrase your second example using the controller … can syntax. You can find more information on that at https://blog.daml.com/daml-driven/daml-does-yoga-an-introduction-to-flexible-controllers

I hope that helps!

3 Likes