Re: DCT: D compiler as a collection of libraries

2012-05-12 Thread Ary Manzana
On 5/12/12 12:17 PM, Roman D. Boiko wrote: On Saturday, 12 May 2012 at 03:32:20 UTC, Ary Manzana wrote: As deadalnix says, I think you are over-complicating things. I mean, to store the column and line information it's just: if (isNewLine(c)) { line++; column = 0; } else { column++; } (I thin

Re: DCT: D compiler as a collection of libraries

2012-05-12 Thread deadalnix
Le 11/05/2012 13:50, Ary Manzana a écrit : On 5/11/12 4:22 PM, Roman D. Boiko wrote: What about line and column information? Indices of the first code unit of each line are stored inside lexer and a function will compute Location (line number, column number, file specification) for any index. T

Re: DCT: D compiler as a collection of libraries

2012-05-12 Thread Roman D. Boiko
On Saturday, 12 May 2012 at 13:24:11 UTC, deadalnix wrote: Le 11/05/2012 13:50, Ary Manzana a écrit : Usually tokens are used and discarded. I mean, somebody that uses the lexer asks tokens, process them (for example to highlight code or to build an AST) and then discards them. So you can reuse

Re: DCT: D compiler as a collection of libraries

2012-05-12 Thread Tobias Pankrath
1. If a struct is a field of heap allocated object, it will be allocated and garbage collected. Only if it only exists on stack (i.e., in method body), GC is not used. As far as I can tell, it won't be allocated on it's own, since it is stored in the garbage collected object as a value field. S

Re: DCT: D compiler as a collection of libraries

2012-05-12 Thread Roman D. Boiko
On Saturday, 12 May 2012 at 20:28:34 UTC, Tobias Pankrath wrote: 1. If a struct is a field of heap allocated object, it will be allocated and garbage collected. Only if it only exists on stack (i.e., in method body), GC is not used. As far as I can tell, it won't be allocated on it's own, sin

Re: DCT: D compiler as a collection of libraries

2012-05-12 Thread Timon Gehr
On 05/12/2012 11:08 PM, Roman D. Boiko wrote: On Saturday, 12 May 2012 at 20:28:34 UTC, Tobias Pankrath wrote: 1. If a struct is a field of heap allocated object, it will be allocated and garbage collected. Only if it only exists on stack (i.e., in method body), GC is not used. As far as I can

Re: DCT: D compiler as a collection of libraries

2012-05-12 Thread Roman D. Boiko
On Saturday, 12 May 2012 at 22:19:55 UTC, Timon Gehr wrote: On 05/12/2012 11:08 PM, Roman D. Boiko wrote: On Saturday, 12 May 2012 at 20:28:34 UTC, Tobias Pankrath wrote: 1. If a struct is a field of heap allocated object, it will be allocated and garbage collected. Only if it only exists on s