guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unknown location: definition in expression context in subform optnam


From: Noah Lavine
Subject: Re: unknown location: definition in expression context in subform optname-from of "_^"
Date: Thu, 26 Jan 2012 21:59:09 -0500

Hello,

>        /* Read expressions from that port; ignore the values.  */
>        for (;;) {
>            SCM form = scm_read(port);
>            if (SCM_EOF_OBJECT_P(form))
>                break;
>            ans = scm_primitive_eval_x(form);
>        }
>
>        return ans;
>    }
> }
>
> Every evaluation comes from here and in this instance, "pzFile"
> pointed to "/path/to/aginfo.tpl" and "line" was set to 163.
> Therefore, the location should *NOT* have been unknown and
> in fact, the displayed line number ought to have been 171.
>
> Why that failed I would very much want to know so that I can
> fix this ag_scm_c_eval_string_from_file_line() thingy.

I am not an expert, but this is my guess about what's happening: you
get the form from the file with scm_read. scm_read returns a regular
s-expression, not a syntax object. Then you pass this form to
scm_primitive_eval_x. scm_primitive_eval_x has a plain syntax-object
with no way to know where it came from, so it prints "unknown
location".

The reason the standard Guile interpreter knows where things came from
is that it parses files as syntax, not s-expressions, and syntax
objects have embedded file and line information.

But note that I didn't say that you could do this. I don't know of an
interface to this functionality (although I believe this example shows
that we need one).

Noah



reply via email to

[Prev in Thread] Current Thread [Next in Thread]