On Friday, 11 May 2012 at 13:28:21 UTC, deadalnix wrote:
Le 11/05/2012 15:01, Roman D. Boiko a écrit :
The problem with placing it in Token is that Token should not know
anything about source as a whole.

I don't really see the benefit of this. You are trading a O(1) operation to an O(log(n)) . It can only be faster in specific cases, which should be measured.
Technically, I'm trading N*0(1) operations needed to track line and column while consuming each character to M*0(log(n)) operations when calculating them on demand. N = number of characters, n is number of lines and M is number of actual usages of Location. My assumption is that M << N (M is much smaller than N).

Reply via email to