How to use material index from Object Info node?
Maybe a slightly obscure one.. I've used the Material Index for discriminating between materials hit by a forward-cast ray in OSL.

Examples here and here... it's one of the few attributes actually returned by a shader-cast ray, at the moment..