What is the purpose of Abstracts? That is, I see that the manual says:
“An abstract type is a type which is actually a different type at run-time. It is a compile-time feature which defines types “over” concrete types in order to modify or augment their behavior”
but I don’t understand what the motivation is for this feature.
Abstract types in Haxe allow creating pure compile-time abstractions (hence the name) over a concrete run-time type. Basically, this way you can introduce new types without wrapping values inside objects at run-time (and thus hurting performance).
Also, abstract support some extra features that are currently not available for other types, like operator overloading and implicit type conversion methods.
Thanks, Dan! Wow, I hadn’t heard of abstracts before. I’m amazed that the compiler can do this for us. I don’t have a use for it right now, but will definitely keep this in mind.