Overlapping functionality: IFTI, templates, is-expressions

BCS BCS at pathlink.com
Wed Mar 19 14:27:36 PDT 2008


Russell Lewis wrote:
> As you can tell from my recent posts (and bug reports), I've been 
> pounding on D's template mechanisms a lot recently.  I'm trying to build 
> a parser generator using templates.  I'm now starting my 3rd major 
> generation of the library, because I keep finding fundamental weaknesses 
> in each method I try.
> 

Do you /need/ one or do you want to /wright/ one? I ask because I have a 
working version of this already.

http://www.dsource.org/projects/scrapple/browser/trunk/dparser

 > [...]

I haven't read your proposals in detail but the first one seems 
impractical because it would be very hard to construct the combined 
template. Consider, for example, a template where it is used to build 
other instances of it's self. Also I /think/ you can overload templates 
from different modules if the args are different.



As to the second >1 tuple idea, firstly, it can be done in a round about 
way (see below) and it has been proposed but no usable way to implement 
it has been put forward. (A few ides have been floated but they have had 
problems)

template A(a...)
{
	template B(b...)
	{
		// template code uses a & b
	}
}

A!(int, char, Object).B!(1, 'g', null)...

> In truth, I have more ideas than just the two above, but the two above 
> would solve most of my issues.
> 
> Thoughts?
>     Russ



More information about the Digitalmars-d mailing list