4 ms·
Sounds like it works just like Go-lang, then. Is there a way to cast something anonymous, just a value read in from JSON, to such an interface? This would all
by Roboprog 10y ago
Sounds like it works just like Go-lang, then.
Is there a way to cast something anonymous, just a value read in from JSON, to such an interface? This would allow you to specify an important subset of things that an object needs to do, verify it in one place, then pass around the interface handle to anything that needed the underlying object in that role. Presumably, if the incoming object lacked the desired attributes, the "cast" would blow up sooner, during the assignment, rather than later, when the interface alias was used.