On 2014-01-05 14:09, Philippe Sigaud wrote:

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.

Just for the record. In Rails, that's the old, now discourage, Rails 2 syntax. In Rails 3 and later the following syntax is preferred:

Table.where(first_name: "foo").first

Which in D would look like:

Table.where(["first_name": "foo"]).first;

--
/Jacob Carlborg

Reply via email to