Hello Philippe,
On Sun, Mar 21, 2010 at 23:02, BCS <[email protected]> wrote:
My unitted type uses it for it's value<->unit properties to get a
single point of definition for each unit:
http://www.dsource.org/projects/scrapple/browser/trunk/units/si2.d
Ah, I see, that's nice. You use the received string to feed another
template
and generate what you need. Good idea.
Why did you make OfType opDispatch a static function?
So that "OfType.someunit(val)" becomes a free function.
I've also been thinking of a way to build a compile time LINQ like
program. If the comparison and boolean operators are overloadable,
you could build prepared SQL queries from expressions at compile
time.
using(myDatabase.tables.baz.bar) foreach(Row!(int) row;
select!("baz.foo").whare(for.a != someInt && baz.c == bar.c))
do(row.foo);
If you have a limited number of methods like .whare, why use
opDispach? (Sorry if my question is naive).
The opDispatch gets used for the .a and .c bits. The above expression would
get translated so that the !=/== expressions just collect values at runtime
and pass them off as parameters of a prepared SQL statement whose string
is built at compile time. For instance the above might result in the following
string literal being used:
"select baz.foo from baz join bar where a = % and baz.c == bar.c"
--
... <IXOYE><