A quick code sample:
`AcceptEither`, a way to accept either one type or another, without resorting to “Dynamic”, and still have the compiler type-check everything and make sure you correctly handle every situation.
Try it on try.haxe.org
The next step would be having Accept2Types, Accept3Types etc, and have a macro automatically build the code for whichever option you ask for.
I just posted a quick gist to the Haxe mailing list showing how one way that abstracts work.
They’re a great way to wrap a native API object (in this case, js.html.AnchorElement) without having to create a new wrapper object every single time. Which means they’re great for performance, the end result code looks clean, and thanks to some of the other abstract magic (implicit casts, operator overloading etc) there is a lot of cool things you can do.
Have a look at the sample, read the Haxe manual, and let me know what you think or if you have questions :)