On Sunday, 23 March 2014 at 13:23:58 UTC, Dicebot wrote:
On Sunday, 23 March 2014 at 13:03:07 UTC, Adam D. Ruppe wrote:
That won't necessarily work in the presence of overloaded functions since getMember only gets one of them.

Yeah, forgot to add this part, will make end result a bit less pretty indeed.

Updated version with overloads will be more reliable than proposed duck-typing version as it won't false trigger in presence of "alias this" or opDispatch. Though Steve may actually want it to trigger, I don't know.

DB,

In my particular question, I would not have wanted, or cared if alias this was triggered, but that was a narrow view.

My primary point is that there should be something in the wiki to help old-fashioned programmers like me to change from an OOP style that is not 100% necessary, to a struct based style that should be quicker, but that allows the compiler to help me, or other contributors to the same project, to write add-on components that are at least checked at compile time.

So what I'm after really, is how do you do interfaces outside of OOP.

Std.range does that sort of thing in what seem to me to be very simple cases, but there is a lot of scope for different scenarios.

Thanks for your answer
Steve

Reply via email to