http://www.cesarbs.org/blog/2010/07/19/run-time-machine-code...
A language which supports it as a feature may do things like partial evaluation of closures, inlining of runtime-constructed code, transforming e.g. the typical block-passing idiom of a Ruby into specific optimized cases. Being able to rely on such transformations in turn lets you build more abstract (i.e. more highly parameterized) libraries because you know you won't have to pay the same degree of abstraction tax.
I'm suggesting a JIT compiler as a built-in language feature so that you could write code in a high-level language and have machine code generated that was specialized based on the program's dynamic state.
It could be done as a library, but it would benefit from language integration so that you wouldn't have to write the code as strings or ASTs.
"With libtcc, you can use TCC as a backend for dynamic code generation." from http://bellard.org/tcc/
And how `new' it is? 1958. Oh dear.
Re: ``C is more Harvard than von Neumann architecture''. Hardly; C is architecture agnostic. You can compile it for a Harvard PIC as well as for von Neumann CPU.
It may seem functions are execute-only, but on common CPUs you can treat them as data as well: read and modify (modulo memory protection). And the other way around too -- you can load a bunch of bytes from a DLL, resolve symbols to obtain pointers and use the pointers to execute the loaded bytes as functions.
--
The syntax for functions is lists. But at runtime functions are their own type.
Are you sure? [2]
How about no? [3]
Perhaps you prefer Vim over Emacs? [4]
---
[1] http://en.wikipedia.org/wiki/Picolisp my favorite
[2] http://en.wikipedia.org/wiki/Scheme_(programming_language) probably the best known
[3] http://en.wikipedia.org/wiki/Arc_(programming_language) this bloody website runs on it
[4] http://en.wikipedia.org/wiki/Emacs_Lisp the good, the bad and the ugly, all in one package
(car (list 1 2 3 4))
with (car (lambda (x) x))
But I guess we are talking about different levels of abstraction?Actually I was almost going to add (car '(lambda (x) x)) to my post in the first place; in line with `The syntax for functions is lists.'
See the three following points:
http://www.software-lab.de/doc/faq.html#dynamic
Alternative phrases for similar-but-not-quite: insidious, error-prone.