Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing source line information #855

Open
ghost opened this issue Aug 25, 2022 · 0 comments
Open

Missing source line information #855

ghost opened this issue Aug 25, 2022 · 0 comments

Comments

@ghost
Copy link

ghost commented Aug 25, 2022

This might be a side-effect of #837 , although I am not very sure about that.

I have two MWEs:

One:

#!/usr/bin/env chibi-scheme
(import (scheme base))
(define (fun-false . o) #f)
(define (parse-url-into-website-program_name-version url)
  (cond ((fun-false)  => (lambda o #t))
        (else (error "cannot parse file name") (newline))))

(parse-url-into-website-program_name-version "")

Seemingly, everything very simple, and as static as can be. However, the stack trace is like:

ERROR: cannot parse file name
  called from <anonymous>
  called from <anonymous> on line 1268 of file /usr/share/chibi-scheme/init-7.scm
  called from <anonymous> on line 800 of file /usr/share/chibi-scheme/init-7.scm

The script file name is not in the stack trace, which is kind of weird? Well, the function call may be eliminated due to tail recursion, but "error", I guess, can save source line information somewhere?

The other one is :

#!/usr/bin/env chibi-scheme
(import (scheme base))
(define (fun-false . o) #f)
(define (parse-url-into-website-program_name-version url)
  (cond ((fun-false)    => (lambda o #t))
        (else (error "cannot parse file name"))))
(parse-url-into-website-program_name-version "")

And the stack trace is:

ERROR: cannot parse file name
  called from <anonymous> on line 1268 of file /usr/share/chibi-scheme/init-7.scm
  called from <anonymous> on line 800 of file /usr/share/chibi-scheme/init-7.scm

So the difference is a missing (newline), which, I guess, is a syntax error, but having it influence the stack trace is confusing as well.

If that "always failing" procedure is removed, but the erroneous (?) (newline) is present:

#!/usr/bin/env chibi-scheme
(import (scheme base))
(define (parse-url-into-website-program_name-version url)
  (cond (else (error "cannot parse file name") (newline))))
(parse-url-into-website-program_name-version "")

The stack trace is:

ERROR: cannot parse file name
  called from parse-url-into-website-program_name-version on line 4 of file ./test-error-file-line-info.scm
  called from <anonymous> on line 1268 of file /usr/share/chibi-scheme/init-7.scm
  called from <anonymous> on line 800 of file /usr/share/chibi-scheme/init-7.scm

Suddenly we are getting line information correctly!
However, removing that "erroneous" (newline) removes line information once again:

#!/usr/bin/env chibi-scheme
(import (scheme base))
(define (parse-url-into-website-program_name-version url)
  (cond (else (error "cannot parse file name"))))
(parse-url-into-website-program_name-version "")
./test-error-file-line-info.scm 
ERROR: cannot parse file name
  called from <anonymous> on line 1268 of file /usr/share/chibi-scheme/init-7.scm
  called from <anonymous> on line 800 of file /usr/share/chibi-scheme/init-7.scm

Maybe some syntactic expanders "forget" to attach source line information to sexps? Or, maybe, it would be worth attaching source line information to error objects, regardless of the stack trace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants