M2
M2 copied to clipboard
Resurrect FilePosition
There's an unused m2 type FilePosition which I think would be useful for debugging purposes. It seems similar to the d type Position except for the fact that it's missing the loadDepth (but that can be changed). It would be great if it could be used -- but for that one'd need a new m2 function that gives the current Position in the file (stdio or actual file) being inputted. it could clean up a lot of the formatting code in code.m2, debugging.m2 and nets.m2.
more specifically:
- one would need first a d function
currentColumnNumbersince there is onlycurrentLineNumbercurrently implemented (digression: it's very easy to confusecurrrentLineNumber()andlineNumbereven though they're quite distinct. maybecurrentLineNumbercould be renamedcurrentRowNumber?) - one should decide whether to add
loadDepthor not toFilePosition - finally, one can define (purely at the m2 level) a function
currentPositionthat combines the info above.
If there are no comments, I will implement this (including the renaming to currentRowNumber, which will be easy since it's only used in a couple of places).
What would it be used for?
well, the real motivation for me to introduce currentColumnNumber is I need it for proper error highlighting in the WebApp interface (and I'd rather code this in m2 rather than d). Adding currentPosition is only an extra line of code then, combining the various existing current*. Longer term, I think FilePosition can definitely be used in code.m2, debugging.m2 and nets.m2, but I haven't started looking into it yet.
Okay, sounds good.