4 ms·
All of the ReQL examples are completely unreadable relative to SQL. Call it declarative, format it however you want - a purpose-built DSL like SQL is always go
by WorldWideWayne 12y ago
All of the ReQL examples are completely unreadable relative to SQL.
Call it declarative, format it however you want - a purpose-built DSL like SQL is always going to be easier to grok than a Javascript-inspired functional language (for me at least).
- bmurphy1976 12y agoDepends on your perspective I guess. Having struggled with building easily composable SQL queries for almost 20 years now, I'll take the functional language approach thank you very much.
- WorldWideWayne 12y agoThank you, I updated my statement to reflect that. However, I am imagining a contest where SQL people write SQL and functional people write functional queries... I would bet money that SQL people could identify basic facts about SQL queries faster than functional people could identify the same facts about functional queries. Could be a fun programming game.
- untog 12y agoAll of the ReQL examples are completely unreadable relative to SQL. Because SQL is very familiar and ReQL is not.
- sanderjd 12y agoI think it's more because the javascript-with-callbacks is chatty and ugly. But you can also write it in a more stream-like style. I have no idea why so many examples out there use the nastier style. An example stolen from another commenter: r.table('users').filter(r.row('age').gt(30))
- coffeemug 12y ago> I think it's more because the javascript-with-callbacks is chatty and ugly. We did the best we could with JavaScript. IMO the Ruby implementation of ReQL is dramatically more beautiful. Ruby's blocks fit so well that we don't even provide the `r.row` shortcut in ruby: r.table('users').filter{|row| row['age'] > 30}
- EvanYou 12y agoWith ES6: r.table('users').filter(row => row('age').gt(30))
- TylerE 12y agoYou only write javascript if you're using javascript ;) If you python you use python's native constucts, which if you use python you're naturally familiar with. r.table('users').filter(r.row['age'] > 30)
- dragonwriter 12y ago> All of the ReQL examples are completely unreadable relative to SQL. I don't actually agree with this, but one solution to this would be -- as Google has done with several of its not-traditional-db storage products -- to build a library that takes strings in an SQL-like language (SQL with additions/deletions to align with RethinkDB's features and capabilities) and builds ReQL objects from them. But, while it might have utility, its probably not as high a priority for the RethinkDB team as getting the core features right. My be an interesting third-party add-on, though.
- 83457 12y agoI seem to recall them saying a few years ago that they were not going that way for a reason. That they are opting for an intelligent protocol/driver approach instead so that there is more control over how data is passed and error handling is done... but I don't remember the details
- TylerE 12y agoIt's not a "javascript inspired language". It's the language you're using. If you're using Rethink from Python, you write your queries in Python, etc. See, for instance, http://rethinkdb.com/api/python/ http://rethinkdb.com/api/python/ (You can easily translate most doc pages to the language of your choice using the links at the top of each page.