Subject: Access to bytecode of languages like Perl and Python?

From: Omer Zak <[email-masked]>
Date: Tue, 31 Jul 2001 10:14:41 +0300 (EET DST)

In machine language programming and in LISP, in principle, instructions
and data are interchangeable.

In practice, considering machine language instructions as data or vice
versa is not always feasible or desirable, due to the need for protection
mechanisms, sandboxing, or complexity of machine language instructions
(which requires specific expertise, possessed by compiler writers, to
handle them).

In LISP, it is relatively simple to consider data as code and vice versa.
Sandboxing remains a desirable option.

In other languages (Java, Perl, Python), there is a step of compilation
into bytecode, which then is complicated and inaccessible to the program.
It is possible to construct program code and execute it on the fly by
means of a specific compile function.  However, after compilation, it is
not easy to manipulate the bytecode.

In Tcl it is easier to consider (string) data as instructions.  Modern
versions of Tcl do compile text strings into bytecodes, but this is only
due to efficiency considrations - it is not part of language
specification.

In FORTH, mapping between source code and bytecode is almost trivial.

In LISP, Tcl and FORTH, it is easy to create new control structures.  In
other languages, it is more difficult.

I think it would be cool if it were possible to specify and add to Perl
and Python functions, which manipulate compiled bytecodes.  Such functions
will have to consider the bytecodes as trees.
                                             --- Omer
There is no IGLU Cabal.  However, when it existed, it was COOL!
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html