What do you use opDispatch for?

Philippe Sigaud philippe.sigaud at gmail.com
Mon Mar 22 14:27:01 PDT 2010


On Sun, Mar 21, 2010 at 23:02, BCS <none at anon.com> 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?



> 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).


  Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100322/0a576d60/attachment.html>


More information about the Digitalmars-d-learn mailing list