I have discussed this approach with commercial users. It never got to
implementation, but I'm sure it is doable. You need some extra guiding
to find a symbols you should not mangle because they generate/match data
from the outside world. I once understood that Quintus has something
like this (not sure).
Note that for popular compilers and CPUs, reverse engineering of C and
C++ upto this level is also possible.
Then, there are young and eager teenagers that are perfectly willing to
extract the core from the assembler for a little money :-) That is good
enough to crack your small clever algorithm or attempt to protect your
code from illegal usage (as we all know). For the program as a whole,
this is a lot of work, but that is most likely much easier to copy by
simply looking at the outside and reimplement it. For short, in my
opinion this is mostly a myth.
> > How does Prolog compare to Lisp or Haskell in this regard?
>
> I can tell you that the GHC Haskell compiler generates binaries, and
> offers hardly anything in terms of reflection.
Neither does Prolog for static code. Ok, some (most?) of the
implementations do allow for reflection on static code.
Cheers --- Jan
What "reflection"?...
" In commercial settings it can sometimes be important to protect
intellectual property."
Assume that you reverse engineer CPLEX linear programming code (what is
C++). What is the chance that as the result you will also re-discover
Simplex algorithm and pivoting strategy? "intellectual property" is not the
code, but the algorithms that are behind the code.
Moreover, we distribute Prolog as *.exe file. I wish you good luck in
extracting Prolog code from exe file.
A.L.