Hi, Fis Trivial <ybbs.da...@hotmail.com> writes:
> Mark H Weaver writes: > >> The problem is that there's no place to store the source information for >> symbols in the standard S-expression representation. >> >> The principal defining characteristic of symbols -- that "two symbols >> are identical (in the sense of 'eqv?') if and only if their names are >> spelled the same way" (R5RS ยง 6.3.3) -- combined with the fact that >> 'eq?' is specified to be the same as 'eqv?' for symbols, leaves us no >> way to distinguish two instances of the same symbol, and therefore no >> way to store per-instance annotations such as source information. >> >> Fixing this would require abandoning the plain S-expression >> representation in favor of one in which symbols are represented by a >> different data structure. Our reader would need to be extended to >> support the option of returning this new data representation instead of >> plain S-expressions, and our macro expander would need to be modified to >> accept this new representation as input. > > I still believe it's crucial to give user correct and detailed error > message, I agree. I didn't intend to dispute the importance of good error messages. I merely intended to explain what the problem is, and why it hasn't yet been done. > After poking for a few days, I found that I have hard time understanding > the code, can you give me some hints for reading the code so that I can > understand how to encode the source information. Currently, I am still > trying to make a baby step, encode source information into symbol. It can't be done. I tried to explain the reason in my earlier message, but I guess you don't understand. I don't have time right now to make another attempt. > I know that will break everything, but at least I will have basic > understanding of underlying mechanic. No, it simply won't work at all. > Though I didn't find any keyword like `parser' or `lexer', but I tried > to dig into `scm_read_expression', which returns a stringbuf. What makes you think 'scm_read_expression' returns a stringbuf? It returns an S-expression. I appreciate your willingness to help with this, but I think that you've chosen a task that's too difficult given your level of experience with Guile. If it was straightforward, it would have been done long ago. Mark