Ask HN: What metaprogrammable language do you/would like to use?
21–30 of 76 posts
Re: Ask HN: What metaprogrammable language do you/would like to use?
#22Re: Ask HN: What metaprogrammable language do you/would like to use?
#23This 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.
Note: Haxe does not typecheck macros. See 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 { var s:String = ""; return macro $v{s}; } }
class StringGetter {
public static macro function getString() {
var s:String = "";
return macro ($v{s} : Int);
}
}Re: Ask HN: What metaprogrammable language do you/would like to use?
#24Earlier quoted context omitted.
Which features make it the most advanced?
Compile-time MP and run-time MP. Support for AST and quasi-quote MP, and support for LMS (= lightweight modular staging).
Compile and run-time MP and quasiquoting are basic features; I'd argue that a language without these doesn't even qualify as "supporting metaprogramming".
Re: Ask HN: What metaprogrammable language do you/would like to use?
#25Re: Ask HN: What metaprogrammable language do you/would like to use?
#26If you're interested in functional programming and meta-programming as paradigms, then you should really focus on functional first. The reason is that functional is all about transformation of data structures as a whole (as opposed to altering them bit by bit as in procedural programming) and meta-programming is about treating programs as data and transforming them. You really can only do advanced meta-programming us…
> You really can only do advanced meta-programming using functional techniques. My `loop for (symbol value) on bindings by #'cddr` and "push onto list in a loop, nreverse and return at the end" macros beg to disagree. Metaprogramming is just like any other programming, except that the output is fed to the compiler. The way Lisp is compiled, you can even use code generated by code in code that generates other code. Th…
Re: Ask HN: What metaprogrammable language do you/would like to use?
#27Do use: Common Lisp, Racket, Python, Ruby
Would like to use: Julia, Rust, Elixir
I metaprogram when I see I have already built a mini-language/pattern in my code. Even when writing Lisp, I begin with simple code without extending the language, and only when I have written a bit do I consider looking for patterns.
Re: Ask HN: What metaprogrammable language do you/would like to use?
#28Re: Ask HN: What metaprogrammable language do you/would like to use?
#29- https://speakerdeck.com/itakeshi/metaprogramming-in-scala-th...
- https://geirsson.com/post/2016/02/scalameta/