Does it mean that it supports only basic common denominator features of every language? I am a fan of attributes in C# - are Haxe annotations as powerful?
Out of the box Haxe's metadata[1] to me doesn't appear as powerful as C#'s attributes. The big difference is that they are not type safe and are not type-checked by the compiler.
You can however use any expression you want in them, and have macros read them and confirm they are correct, and do whatever you want with them. For example I do some validation on my models:
@:validate( _.length>0 && _.indexOf(' ')==-1 )
public var username:String;
As for the bigger question - they are limited in what they can add, but they have many features not in other languages, they just implement them in a syntax-heavy way on the languages that lack such features. Pattern matching is a good example [2].
_random_|11 years ago
joneil|11 years ago
You can however use any expression you want in them, and have macros read them and confirm they are correct, and do whatever you want with them. For example I do some validation on my models:
As for the bigger question - they are limited in what they can add, but they have many features not in other languages, they just implement them in a syntax-heavy way on the languages that lack such features. Pattern matching is a good example [2].See http://haxe.org/documentation/introduction/language-features...
[1]: http://haxe.org/manual/lf-metadata.html [2]: http://haxe.org/manual/lf-pattern-matching.html