DCT: D compiler as a collection of libraries

Jacob Carlborg doob at me.com
Fri May 11 06:25:53 PDT 2012


On 2012-05-11 15:01, Roman D. Boiko wrote:

> What about the following signature: Location locate(size_t index)?
> Or even better:
> alias size_t CodeUnitIndex;
> Location locateFor(CodeUnitIndex position);

That is better although I would prefer to pass in a token (assuming that 
is where index is declared). Then it would be an implementation detail 
that "index" is used to get the location.

Another option would be to turn it around:

sturct/class Location
{
     Location find/locate (Token token);
}

> The problem with placing it in Token is that Token should not know
> anything about source as a whole.

I see. For convenience there could be properties defined that just 
forwards the call to some other function.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list