Comment made by: bronsa
Alex, thanks for looking at this,
1- The NIL object is a placeholder in the method impl cache for nil, as find-and-cache-protocol-impl
tests for nil?
to know if the dispatch has been cached or not
2- The change is purely a consistency one, making find-and-cache-protocol-impl always return a class/interface rather than either a class/interface or a concrete instance. Behaviourally, it doesn't change anything since the two consumers of find-protocol-impl
, namely find-protocol-method
and satisfies?
don't care what that value is in that case
3- Yes you are correct that it is not thread safe, however I think it's a decent tradeoff as it doesn't cause any incorrect behaviour and at worse would cause an extra cache miss, making it thread safe would mean an extra performance penalty in every cache hit/miss