3 ms·
Still no signs of understanding the value of static metaprogramming. C# used to be promising.
by sklogic 11y ago
Still no signs of understanding the value of static metaprogramming. C# used to be promising.
- SideburnsOfDoom 11y agoCould you elaborate on what you mean by "static metaprogramming" ? Google isn't helping me here. Perhaps an example of a program or language that does this. I see you talk about Lisp and ML a lot - are you referring to macros(1) to extend the language? 1) http://stackoverflow.com/questions/267862/what-makes-lisp-macros-so-special http://stackoverflow.com/questions/267862/what-makes-lisp-ma...
- sclangdon 11y agoI think he's talking about C++ templates. https://en.wikipedia.org/wiki/Template_metaprogramming https://en.wikipedia.org/wiki/Template_metaprogramming
- SideburnsOfDoom 11y agoIs C++ template metaprogramming really the most desirable feature to add to the C# programming language? I really hope not. I occasionally wish there were ways to get at the compiler features that add "yield return" and "async ... await" to the C# language and use them for your own extensions, but the hacks that make c++ templates turing-complete definitely don't seem to be a desirable way to do it.
- sklogic 11y agoC++ templetes are a very weak form of a static metaprogramming. Lisp macros are closer to an ideal level.
- sklogic 11y agoYes, I'm talking about the compile-time (i.e., static) macro metaprogramming, as in Lisp, Scheme, Template Haskell, CamlP4, Converge, Nemerle, Rust, Julia, etc. As opposed to a dynamic metaprogramming (e.g., expression trees in C#).
- SideburnsOfDoom 11y agoThanks. FWIW, "static" has a specific meaning in C# that doesn't refer to compile-time vs run-time. Similarly "dynamic". Neither "static metaprogramming" nor "dynamic metaprogramming" give many relevant results on google, so perhaps other terms are more commonly used? As I said in the other reply, it seems intriguing that some features of C#, e.g. extension methods, yield return, async .. await are essentially rewrite rules. Ways to get at the compiler features that add them to the C# language would be interesting, but the concept seems to be made much harder by the complex curly-brace syntax not being designed for that; it's rather the opposite of lisp.
- sklogic 11y agoYes, "compile time metaprogramming" or "static code generation" vs. "run-time metaprogramming" and "dynamic code generation" are used more often. Once you've got proper macros, pretty much all the other language features can easily be implemented on top of them, so it makes much more sense to get the macros first instead of adding features one by one. I could never comprehend why the mainstream language designers are not doing it. Syntax is not an obstacle for a proper macro system, as demonstrated by Template Haskell, Nemerle, Katahdin, PFront and the other meta-languages not based on S-expressions. The only thing you need is a quasiquotation for both constructing and pattern matching the ASTs, and it's possible to implement it for any syntax.
- wtetzner 11y ago> Syntax is not an obstacle for a proper macro system, as demonstrated by Template Haskell, Nemerle, Katahdin, PFront and the other meta-languages not based on S-expressions. Also see Honu[1], which effectively brings Racket's syntax-case into a curly-brace language. [1] https://www.cs.utah.edu/~rafkind/papers/honu-2012.pdf https://www.cs.utah.edu/~rafkind/papers/honu-2012.pdf
- sklogic 11y agoThanks! Did not know of this one.