[racket] file-position and source-location-position

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Jun 7 00:27:58 EDT 2012

At Wed, 06 Jun 2012 23:43:25 -0400, Neil Van Dyke wrote:
> Question: A number for source location position of a syntax object is 
> what file-position would say after the first character of the syntax had 
> been read?

It's what `port-next-location' reports, which is the same as
`file-position' afterward only if the source is ASCII or line counting
isn't enabled.

> I'm double-checking before I code this into an API.  I see in 
> "http://doc.racket-lang.org/reference/linecol.html" the statement 
> "Position and line locations are numbered from 1; column locations are 
> numbered from 0."  I would've expected position to be from 0 (like 
> "file-position"), and line and column to both possibly be from 1 (like 
> most programming tools use), but at least for line and column to use the 
> same base.

I guess I consulted Emacs for the numbering convention. The top-left
corner of an Emacs buffer is line 1, column 0, character (i.e.,
position) 1.


Posted on the users mailing list.