Hi, guiles. I'm new to scheme and guile. Most of the time, I am a c/c++ and python programmer. One thing that bugs me about writing scheme with guile is that I can't have full source information when reading backtrace.
For example, in the following snippet (test.scm): ---------------- (use-modules (ice-9 pretty-print)) (define (function) (format #t "function")) (define* (function-asterisk) (format #t "asterisk")) (format #t "function properties:~a~%" (source-properties function)) (format #t "asterisk properties:~a~%" (source-properties function-asterisk)) (define var "normal var") (format #t "normal var properties:~a~%" (source-properties var)) ---------------- With guile-2.2.3, running $guile ./test.scm , I got the following result: ---------------- function properties:() asterisk properties:() normal var properties:((line . 9) (column . 12) (filename . /home/fis/Others/git-repos/compliers/guile/./test.scm)) ---------------- In which you can see, only `var' has non-empty source-properties. Further, if I enter the above snippet in guile shell, then source-properties is not recorded even for `var'. I tried to dig in the source code of guile, so far I have found two related functions: `scm_primitive_load' in load.c `maybe_annotate_source' in read.c. Using gdb to break on these two function doesn't stop the process. Only running (primitive-load "test.scm") inside guile shell invoke these two functions. The finding is far away from knowing how to make guile record source information for every symbols. Can you give me some guidance for how to achieve the goal(record all source information for every symbol). If it's theoretically impossible or hard to achieve, can you give me some inside why and advises for making best effort? I intend to help, so pointers to internal structures are also welcomed. Thanks in advance.