This is the mail archive of the guile@cygnus.com mailing list for the guile project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
So is there a resolution?
Point of information: I convinced Stallman that 1-origin column
numbers are more natural for (non-programmer) users, but he is
not sure whether it is better for column numbers to match
(naive) user expectations, or whether they should match the
ELisp API.
Here is my suggestion:
- primitive: port-column [INPUT-PORT]
- primitive: port-line [INPUT-PORT]
Return the current column number or line number of INPUT-PORT,
using the current input port if none is specified.
If the number is unknown, the result is #f. Otherwise,
the result is a 0-origin integer - i.e. the first character
of the first line is line 0, column 0. (However, when you
display a file position, for example in an error message,
we recommand you add 1 to get 1-origin integers. This is
because lines and column numbers traditionally start with
1, and that is what non-programmers will find most natural.)
We might consider as a future extension that output ports
could also support port-line and port-column. One use for port-column
for output ports is to support the tabulate format specifier.
(The Common Lisp "tabulate" format specifier has 0-origin columns.)
--Per Bothner
Cygnus Solutions bothner@cygnus.com http://www.cygnus.com/~bothner