Is it possible to handle 'magic' property assignments a'la PHP?

Philippe Sigaud philippe.sigaud at gmail.com
Sun Jan 5 05:09:25 PST 2014


On Sat, Jan 4, 2014 at 10:08 PM, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:

> Of course, these are arguably clever hacks than true, properly-motivated
> examples, but still, they exemplify what Andrei meant when he said that
> the power of opDispatch is largely still unexplored territory.

As Adam showed, it's very nice to make some clean API (or DSL).

Another example I like is generating queries:

auto result = table.findByFirstName;

If Table has a "FirstName" field, then opDispatch will catch any
findByXXXXX and generate the related query. A bit like Activerecord
for Ruby.


More information about the Digitalmars-d-learn mailing list