by dmux · 4y ago · 0 comments
The fact that this was once the norm but has since been done away with saddens me. I've always been fascinated with "live environments" but felt they only went half way if they didn't include the source code itself. If I'm going to be updating something in a running system, I want to know what source code was used to get the system to the state its currently in, and preferably be able to query that source code as data. Of course, that code could be kept within source control, but then it's a shadow of the running system -- a map of the territory and not the territory.
As far as I know, the only languages/environments where this functionality is still available are Tcl, Smalltalk, and to some extent stored procedures within an RDBMS.
If the Forth compiler generates native code the one-to-one relationship with the source is lost and SEE will typically show the compiled code as Assembly Language.
And its easy to view the source code from the console (REPL). Some examples from Rebol2...
>> source func
func: func [
"Defines a user function with given spec and body."
[catch]
spec [block!] {Help string (opt) followed by arg words (and opt type and string)}
body [block!] "The body block of the function"
][
throw-on-error [make function! spec body]
]
>> source source
source: func [
"Prints the source code for a word."
'word [word!]
][
prin join word ": "
if not value? word [print "undefined" exit]
either any [native? get word op? get word action? get word] [
print ["native" mold third get word]
] [print mold get word]
]http://www.lispworks.com/documentation/lw80/lw/lw-dspecs-ug....
Common Lisp has standard function FUNCTION-LAMBDA-EXPRESSION:
* (defun foo (a)
(my-if (> a 10) 'big 'small))
FOO
* (function-lambda-expression #'foo)
(LAMBDA (A) (BLOCK FOO (MY-IF (> A 10) 'BIG 'SMALL)))
T
FOODoesn't FUNCTION-LAMBDA-EXPRESSION apply here?