3 ms·
In Java, I would do this: new Search().equal(Search.NAME,"Joe") .between(Search.AGE,18,25) .go(); Just as concise with less vood
by extension 16y ago
In Java, I would do this:
new Search().equal(Search.NAME,"Joe")
.between(Search.AGE,18,25)
.go();
Just as concise with less voodoo. And it's a single statement.
With the existing method, you can still ditch the empty parens by using public final fields. You just have to pre-populate them all with respective grammar objects.
- pgr0ss 16y agoYour syntax is definitely simpler. One reason we did it the way we did was to get compiler checking for operators. We've tried to follow idioms in different client libraries, and for the statically compiled languages, we've tried to make it so if it compiles, it will work. Since the field comes first (orderId().startsWith()), if you try to call an operator on a field that does not support it, it will not compile.
- supersillyus 16y agoYou should make it clearer in the commentary that you're holding the static languages to a higher standard.