libera/#sicl - IRC Chatlog
Search
4:06:10
beach
The plan I have for SICL (but it has not been tested yet) is to report errors as source locations, and then have them displayed in some kind of IDE so that the location is highlighted. Not sure yet whether that would be enough.
4:07:10
Bike
that's what i'm doing now, with slime, but practically speaking not everything is compiled in an IDE
4:08:30
beach
Of course. I don't know how much I myself am willing to work in order for it to be convenient for non-IDE users.
4:13:54
moon-child
and: it's not as if sicl is the only cl implementation, should somebody need such functionality
4:17:30
Bike
i think i will do it, just because I can't think of a way to search through the source for the correct source position that wouldn't be awkward and buggy
4:20:21
Bike
like, consider we have (lambda (x) (+ x "foo")) or something. we've converted this to IR and now notice we should warn about the type problem. the IR nodes have source positions, so we know the source position; but we don't have the actual (+ x "foo") form. we could get it, either by reading through the source file or by searching the input CST, but we don't have it in an obvious way
4:20:40
Bike
and now that i'm thinking about it this would also be good for COMPILE or the like, where there is no source position but we still want to report something
4:21:21
beach
In SICL, I have a list of source lines, a start line, a start column, and end line, and and end column. I would just display the source code from it.
4:22:56
Bike
how does that work? You call cst-read, you check the source range, then go back and get the actual text from the file?
4:23:30
beach
I read the entire file into memory and then I have a Gray stream that reads from there.
4:24:15
beach
A long time ago, when I suggested this idea to drmeister, he immediately rejected it as taking too much space. But that was is "fast module" reacting. After some calculation, you can clearly see it is small.
4:25:07
beach
The other advantage with this solution is that the source location will always be accurate, even if the file is gone or has been modified.
4:26:02
Bike
so would an error have the actual source form? or would it just have the text? or would the form be read again from the text?
4:26:28
beach
I already use this system in the CLIM-based backtrace inspector. It nicely shows the source text with the form highlighted.
4:27:47
beach
The idea is that any error message that is phrased in terms of code would be likely to be incorrect because of macro expansions. So the only thing that makes sense to the application programmer is the original source code.
4:29:09
Bike
well, you could use the originally read in form before macroexpansion. which is what i was planning on. if csts refer to other csts like i described it should be pretty doable.
4:29:48
beach
Yes, but then displaying the source location would be harder, and you would get things like upper-case symbols.
4:30:13
moon-child
assuming you give me a pointer to the relevant portion of the source, I can look at it myself; I don't need it duplicated in the error message
4:32:34
beach
In an IDE, it would be "reported" by a highlighted portion of the text in a different window.
4:32:58
moon-child
it will still be necessary to look at the relevant portion of the source in order to fix it
4:33:18
moon-child
(then--I think my views on error messages are not representative. So perhaps I should shut up)