Version 9 of data is not abstracted from the language

Updated 2004-06-01 13:03:04 by lwv

"Data is not abstracted from the language". This phrase from About Tcl and popularity has been echoing on my mind. I sort of understand what it means. But only so much. I can't say I understand it because I still can't see the possibilities it creates. More explanation, examples and lucubrations welcomed.


RS: The language manifests itself in scripts, which are strings.

It is brought to life in commands, which are lists (which are a view on strings).

In data, everything is a string, and many strings can be evaled if they're in the (current) language. Every proc can be reconstructed to be a string with info args, info default, info body. In short: Code is data. Data is code. Everything is possible :)

LES: I understand that. But that still is as far as I could go before I asked my question. I still don't see what ocean of possibilities that wondrous trait could open to me. A little but very practical example, perhaps? Anyone?

LV: Think of it this way. When someone programs in a language where data is seperate from the language, it becomes more difficult to do things like dynamically change the application.

If I were writing C code, and I wanted the user to be able to change the application they were running for some reason, then I'd have to have them provide me some data, then generate or modify one or more C code files (or files to be included by the C code), then exec a compiler, and, when that worked, exec the new binary overtop the binary currently running in memory. I'd have to be careful on some systems that the modified binary didn't replace the running one on the disk, because on some systems that would crash the application.

Now, take a look at a dynamic language like Tcl. In Tcl, the user can provide input, or Tcl can generate (even randomly), code that can be either executed immediately, or code that can be written to disk and then sourced into the current interpreter, or modify the current application and exec it just like we did in C.


Category Concept | Category Example |

Arts and crafts of Tcl-Tk programming - is that a category? RS: No - it was the earliest cross-link, categories came later. I still often use when I don't want to think about categories :)