Skip to content

Comment on Beating the Arc Challenge in Haskellparent

Comments

If I create syntax with a program (code with code) is that metaprogramming? Doesn't c++ or any text generating code already do this?

Maybe it's not "native" and I have to run system level calls to force compiles and execution of created code.

Almost all programs do metaprogramming (interpreted code, scala on the jvm, etc).

What's the differentiatior for Lisps Metaprogramming (self contained languange structures?).

I'm pretty interested in simplification of programmer interfaces on iteratively more functional (but perhaps more complex) underbellies. I will certainly investigate.

My definition of metaprogramming is writing a program that manipulates itself. I'm not sure I would call any arbitrary code generator metaprogramming as this would cause the "self" in my definition suffer a severe identity crisis :-)

But yes, C++ templates as well as Lisp macros are compile time metaprogramming. All languages that have eval and/or allow function/method bindings to be replaced at runtime allow runtime metaprogramming.

Since static typing guarantees certain invariants it cannot be compatible with a program that violates those invariants at runtime. You could still decide to consider it metaprogramming when the program manipulates itself only within the limits of those guarantees, but when you look at what real world runtime metaprogramming is being used for (for instance in Rails) you will realise that these things (e.g method_missing) would not be possible within the limits of a statically typed language.

[edit] Lisp makes both compile time and runtime metaprogramming exceptionally easy due to its homoiconic nature.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.