In a way queries are lazy. You can write a query and without calling `run` on it nothing happens. The whole chained ops are executed at once when `run` is called.
> That said, it is also my opinion that the ORM syntax needs a bit of love, for all the reasons stated above.
This is not an "ORM" per se. It's a query API or data manipulation language. The next version will bring a few improvements to it.
That's not lazy, though, that's just doing nothing :P Lazy would be not running anything until you evaluated the last link in the chain, so, in Django:
model = User.objects
model = model.filter(name="Alex")
model = model.filter(hero="Dazzle")
model = model.filter(abandons<2)
list(model)
and the query would only be executed when wanting to turn the QuerySet into a list.I think your examples would also be a bit clearer if you forewent the r.db("test") step and just did:
db = r.db("test")
db.query("foo").bar().run()
which is more explicit.thanks,
alex @ rethinkdb
I actually think strict is better here, but that's a different discussion altogether :)
I don't see how it wouldn't be optimal, since lazy evaluation is a superset of eager evaluation (you can invoke it whenever you want).
That said, it is also my opinion that the ORM syntax needs a bit of love, for all the reasons stated above. Especially .run() feels a bit weird, can you make queries lazy (like Django's QuerySets, which only run when evaluated)?
P.S. If the rest of the RethinkDB team are as good at DOTA 2 as Marc is, I want to play with you too!