Hacker News new | ask | show | jobs
by pjmlp 1653 days ago
COM solves this with delegation, where objects can only implement the methods that they care about and delegate everything else to the aggregated type, which provided the full interface.

However, depending on which stack one is using (VB 6, .NET, MFC, ATL, WRL, WinRT), the amount of boilerplate to deal with the runtime differs.

1 comments

I wish more languages (in fact, any popular languages!) had convenient syntax for this.
Dynamic languages have it, via "doesNotUnderstand" and similar.

Kotlin also provides a way similar to those COM variants,

https://kotlinlang.org/docs/delegation.html#overriding-a-mem...

Best support is probably MOP in Common Lisp, I guess.

The Kotlin version is pretty much what I had in mind, that's pretty nice.
Any time one dares to defend Pascal's "with" statement, a shitstorm starts...