4 ms·
You can change the implementation of the protocol, but then it's changed (in that it replaces the prior version). When you see something of type X, the protoco
by puredanger 16y ago
You can change the implementation of the protocol, but then it's changed (in that it replaces the prior version). When you see something of type X, the protocol says what to do when you encounter a function on X. If you want more than one kind of thing to happen, then you shouldn't use a protocol.
For instance, it would be perfectly feasible to use a multimethod that dispatches on both type and output format. Or a protocol that dispatches on type, then dispatches a different function on format.