Thanks Tom, Glyph.
I raised an issue for the `host` parameter at https://twistedmatrix.com/trac/ticket/10251. Who knows, I might even get round to opening a PR for it real soon now.
On 08/08/2021 03:22, Glyph wrote:
On Aug 7, 2021, at 2:15 PM, Tom Most <email@example.com mailto:firstname.lastname@example.org> wrote:
This one seems less clear-cut to me. I think that you could use connectTCP through and endpoint like IHostnameEndpoint and they'd always be passed.
Perhaps optional parameters are usually not a good idea for interfaces? I'm thinking of IAgent.request , where the optionality of the headers parameter leads to a lot of similar-looking conditional code in every implementer. Best to hoist that logic to a top-level facade (e.g., Treq).
I agree with the general point about optionality, but I would say that a zillion clients would break with your implementation if you required bindAddress and timeout, so in this case let's just make IReactorTCP reflect actual reality.
Is there a way to define a parameter as optional in an Interface, without forcing the Interface to define what the default values are? It seems reasonable to me that different implementations might want to have different defaults for these parameters, so the default values should be properties of the implementation, not the interface.