4 ms·
For me, "code as data" means that the code I write provides a particular structure (whether to create a report, or go through an editing task or find particular
by whitten 9y ago
For me, "code as data" means that the code I write provides a particular structure (whether to create a report, or go through an editing task or find particular information in the computer). I then use a table-driven "data" approach to finding the particulars that are significant for this particular class of information. That might mean that I have the unique code stored in a table which I lookup using a relevant key, hence "table-driven code", or I have "setup code", "one iteration", and "teardown code" accessible through an indirect call because the structure of the code to do the task can stay the same. It is also common to have a general "event" fire at the end of the code to inform any other programs that need to know this data structure or real-world event has been accounted for. I think this approach is amentable to better testing, and can be viewed as a higher-level abstraction similar to LISP macros. (Even though my language of choice - MUMPS) doesn't have LISP-style syntactic macros.