Every time I get to the point of generalizing some service usage into something that I can have real world values in, and then a mock or other implementation there of, I think about protocols and try, again, for the Nth time, to use them and not run into walls.
I have not really ever understood why Protocol is any different from Java interfaces. Why do protocols have so many short coming limitations on how and when they can be used. In particular, I have ObservableObject on an existing “service object” and I want to be able to use DI for its value and using a protocol would make that a really flexible thing to do. However, I cannot put ObservableObject on a protocol, and then have that become part of how the object implementation works. I don’t know how code generation is happening, but suspect that what the problem actually is, is that we still have Obj-C and C/C++ weaved in behind the scenes in such a way that Protocol is not really a simple declaration thing like Java’s Interface is.
My question is, will protocols ever become useful as a general tool, or are they really just a way to put a name on a collection of details that you can’t really abstract into use with all the other places that struct and class are actually used?