DIP 50 - AST macros
Jacob Carlborg
doob at me.com
Mon Nov 18 13:15:03 PST 2013
On 2013-11-18 22:08, IgorStepanov wrote:
> May be this way is good for D? And CTFE allow to parse this tree
> at compile-time.
> Something like:
>
> @property Collection where(alias cond, Collection)(Collection c)
> {
> enum ast = cond.astof;
> static if(is(Collection : DBResultSet))
> {
> string where_cond = generateCondition!(ast, Collection);
> return c.doWhere(where_cond);
> }
> else
> {
> ...
> }
> }
>
> ...
>
> auto result = db.myItems.where!(x => x.Count > 10);
The idea is to have something more general. Linq is just one example of
what can be implemented.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list