Brex tests agents: by committing fraud
brex.com3 pointsby brandonbloom0 comments
type Frob struct {
SomeFlag bool
AnotherArg string
}
func (args Frob) Do() FrobResult {
// ...
}
// Later:
res := Frob{SomeFlag: true}.Do()
This saves the stuttering of `Frob(FrobOptions{`, should have identical performance to that, with nicer syntax, and has a smooth upgrade path for all the sorts of things folks do with the command pattern (such as logging, dynamic dispatch, delayed execution, scripting, etc).