What do you use opDispatch for?

BCS none at anon.com
Sun Mar 21 15:02:06 PDT 2010


Hello Philippe,

> OK, I know opDispatch just appeared in DMD, but I remember a *huge*
> thread on it, where people were jumping up and down waiting for it.
> 
> Me, I have no wonderful idea, though I feel some potential in it. The
> only interesting use I found for now is making a class/struct
> extensible:
> 
[...]
> 
> As for you, what are your experiences / projects with opDispatch?
> 

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

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




> Philippe
> 
-- 
... <IXOYE><





More information about the Digitalmars-d-learn mailing list