Currently, if a function takes optional arguments, I just make multiple functions with different names and place the default arguments in these function definitions. I think this is fine, but maybe there is a more readable way to do this. Golang does not support method overloading and optional arguments. I could also try variable length arguments.
Current method
// https://html.spec.whatwg.org/multipage/parsing.html#appropriate-place-for-inserting-a-node
func (c *HTMLTreeConstructor) getAppropriatePlaceForInsertion() insertionHandler {
return c.getAppropriatePlaceForInsertionWithOverrideTarget(c.currentNode)
}
// https://html.spec.whatwg.org/multipage/parsing.html#appropriate-place-for-inserting-a-node
func (c *HTMLTreeConstructor) getAppropriatePlaceForInsertionWithOverrideTarget(target *dom.Node) insertionHandler {
}
Currently, if a function takes optional arguments, I just make multiple functions with different names and place the default arguments in these function definitions. I think this is fine, but maybe there is a more readable way to do this. Golang does not support method overloading and optional arguments. I could also try variable length arguments.
Current method