On Friday, 11 August 2017 13:12:32 BST Jean-Paul Calderone wrote:
> On Fri, Aug 11, 2017 at 6:46 AM, Barry Scott <barry.sc...@forcepoint.com>
> 
> wrote:
> > I porting some code to latest twisted and I;m seeing the old code expects
> > to
> > call loseConenction with a reason.
> 
> This code makes the mistake of treating a peculiarity of a particular
> implementation of an interface as the interface itself.
> 
> > But loseConnection in class ConnectionMixin does not have the parameter.
> 
> Nor does the definition of loseConnection on the interface:
> 
> http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.I
> Transport.html#loseConnection
> > Is this an oversight or deliberate?
> 
> Code that goes beyond the guarantees of the interface is limiting itself to
> working with a particular implementation.  Sometimes it is less than clear
> whether some behavior is intended to be guaranteed by the interface or not
> - but in this case, it's pretty clear.  loseConnection accepts no
> arguments.  Code that passes an argument may work with a specific
> implementation but there's no guarantee it will work with other
> implementations.  And "other implementations" includes "future versions of
> a specific implementation".
> 
> So, it's deliberate.  If you want to make the application code in question
> more portable across implementations, it should stop passing an argument.

Thanks for the clarification.

That begs the question of why any implementation of loseConnection has
extended beyond the interface.

Barry

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to