On 2013-09-22 01:45:33 +0000, Walter Bright <[email protected]> said:

On 9/21/2013 6:09 PM, Sean Kelly wrote:
A single pointer per file isn't much memory and a write per line isn't much
of a speed hit. Fair point about holding the file in memory except that DMD
does this anyway. Mine wasn't a general comment so much as one specifically
about the D front end. As for the rest, if you can see the problems with an
approach before starting then don't do it that way. :-)

It isn't once per file, it's once per node in the AST, plus all the copying around of the value(s).

You could *replace* the line number with a "byte from start of file" and then compute lazily either the line number or the column number for the rare times where you actually need to get the line or column number. (Ideally you'd also keep a map of the byte offset for the start of each line in a file to make that computation fast.)

Column values are of interest in an IDE because it can pinpoint the error more precisely. The IDE can show exactly where the error is (for instance with a dotted red underline), often allowing you to fix the error without even reading the error message (especially when it's a typo). With a background-compilation-as-you-type system you know almost immediately when you make an error, and you know where it is.

I do agree that it is of minor interest when you're reading the error log.

--
Michel Fortin
[email protected]
http://michelf.ca

Reply via email to