3 ms·
This list is missing Haxe, which is strictly-typed (with type inferencing), supports object-oriented, generic, and functional programming and is highly extensib
by markknol 7y ago
This list is missing Haxe, which is strictly-typed (with type inferencing), supports object-oriented, generic, and functional programming and is highly extensible thanks to meta-programming (macros). Interoperability is where it excels, since it compiles to to multiple language targets/platforms, including VM bytecode.
- klntsky 7y agoNote: Haxe does not typecheck macros. See https://haxe.org/manual/macro-ExprOf.html https://haxe.org/manual/macro-ExprOf.html For example, this seemingly ill-typed definition (which should return Int as suggested by the type paramater, but in fact returns a string) successfully typechecks: class StringGetter { public static macro function getString():haxe.macro.Expr.ExprOf<Int> { var s:String = ""; return macro $v{s}; } }
- k_ 7y agoThat's not entirely true. `ExprOf<T>` itself is not checked in either the macro function argument or return type, but that's only meant for static extension (and maybe some other features?). Expressions generated by your macros will be parsed by the type checked. You won't be able to do var s:Int = StringGetter.getString(); Because you'll get a compilation error there (http://try-haxe.mrcdk.com/#48EDb http://try-haxe.mrcdk.com/#48EDb).
- nadako 7y ago> Haxe does not typecheck macros. That is a weird statement. Haxe expression macros by definition return untyped AST to be processed further normally by the typer, just like hand-written code. And it will be type-checked. And then there's an AST node existing exactly for type-checking (or, rather, type unification) that you can generate to insert custom checks: https://haxe.org/manual/expression-type-check.html https://haxe.org/manual/expression-type-check.html
- b2d 7y agoIncorrect. To quote the page you've linked: "For the most part, this type is identical to Expr, but it allows constraining the type of accepted expressions." or otherwise put: ExprOf only affects macro arguments, not return value. What you want is this: class StringGetter { public static macro function getString() { var s:String = ""; return macro ($v{s} : Int); } }