News for hackers. Stuff that matters.
Re:DataScript – Datomic in ClojureScript by drcode on Thursday April 24, 2014 @12:21PM (#7641224)
Looks like a great library... It would be intriguing to try to use something like DatomicScript for the app state of an Om application.

(Edit: Read in a separate blog post that the author of DatomicScript is thinking about this already)

At the end of the day though, I still think someone (smarter than me) needs to figure out the full end-to-end solution for datomic+clojurescript, with both client and server elements.

The core question: Does it make sense to map datomic to a REST API on the server, then consume the REST on the client? Or, does it make more sense to build something more clojure-like for the client-server interface, and remove REST from the equation entirely?

Re:DataScript – Datomic in ClojureScript by davidrupp on Thursday April 24, 2014 @08:58PM (#7644110)
Datomic is bundled with a REST server: http://docs.datomic.com/rest.html. And it includes an endpoint to subscribe to a stream of Server-Sent Events, which lets you drink from the transaction-report firehose. But there is a lot of data in that stream. I'm writing a production Pedestal app, and I could definitely use the capability to store my data on the client in the same shape as Datomic and query it with Datalog.
Re:DataScript – Datomic in ClojureScript by tony_landis on Thursday April 24, 2014 @01:07PM (#7641516)
A seamless datomic <-> clojurescript client/service framework is needed. I am just getting started with Om and hope to experiment with some ideas in that space. I don't think REST is the right approach. I would like to abstract everything to an AVET or sequence thereof.
Re:DataScript – Datomic in ClojureScript by dustingetz on Thursday April 24, 2014 @03:39PM (#7642457)
i think you want the application-facing interface to remain REST (links between entities, HATEOAS), but the REST/CRUD client's transport layer wouldn't be traditional http/ajax, rather implement similar capabilities to a Datomic Peer. So a CRUD READ would query a cached Datomic index rather than touch network. Create, Update, Delete could be http/ajax or could be something else like a websocket; I believe transport to be orthogonal to the fundamental principles of REST application design.
Re:DataScript – Datomic in ClojureScript by vdm on Thursday April 24, 2014 @01:51PM (#7641763)
Re:DataScript – Datomic in ClojureScript by drcode on Thursday April 24, 2014 @09:12PM (#7644155)
Interesting, I get the feeling though that RH also thinks this isn't the right approach, that some more though needs to be put into the client-server interface still that goes beyond vanilla datomic.
Re:DataScript – Datomic in ClojureScript by tonsky on Friday April 25, 2014 @02:10AM (#7644972)
Thing is, server-side Datomic peers work in trusted env; every peer sees everything. As you start doing something like a peer in every browser that opens your app, you need to provide it only with the part of the database. This filtering should be done two-way (what’s allowed to read, what’s allowed to push back) and is not very straightforward thing to do. It’s not even clear how this thing should be configured. Also server-side lazy loading model won’t work in JS — queries will become async. Given that, server-client communication layer can be implemented, I guess, but it won’t look like anything like vanilla Datomic peer.
Re:DataScript – Datomic in ClojureScript by mvzink on Thursday April 24, 2014 @04:08PM (#7642662)
Exciting prospect. How about DataScript for your app state + tx-listen/om-sync mirroring transactions? Might require wrapping the datascript/transact! call, and I haven't thought about reading from the cliente. Maybe as simple as lazily mirroring datascript/q calls and filling those back into the DataScript map.
Re:DataScript – Datomic in ClojureScript by puredanger on Thursday April 24, 2014 @02:58PM (#7642184)
Re:DataScript – Datomic in ClojureScript by dj-wonk on Thursday April 24, 2014 @04:44PM (#7642852)
HN moderators: can you please rename the post, since the project has been renamed to DataScript: https://github.com/tonsky/datascript/commit/5beb53d7db03bd27...
Re:DataScript – Datomic in ClojureScript by dang on Thursday April 24, 2014 @05:23PM (#7643127)
Sure.
Re:DataScript – Datomic in ClojureScript by imslavko on Thursday April 24, 2014 @01:45PM (#7641730)
Not familiar with Datomic. Does it mean now you can reuse querying code on the server to real Datomic and on the client (in browser) to DatomicScript?

If so, it could lead to some features like latency compensation and stubs similar to Meteor's MongoDB and MiniMongo. That would be cool.

Re:DataScript – Datomic in ClojureScript by tonsky on Friday April 25, 2014 @02:03AM (#7644962)
Yes, query language is almost identical.
Re:DataScript – Datomic in ClojureScript by sethev on Thursday April 24, 2014 @12:50PM (#7641412)
This looks like a very interesting project although it's a bit confusing that it's named after a proprietary database.
Re:DataScript – Datomic in ClojureScript by puredanger on Thursday April 24, 2014 @02:58PM (#7642185)
It has now been renamed to DataScript. https://twitter.com/nikitonsky/status/459403600775876608
Re:DataScript – Datomic in ClojureScript by ibdknox on Thursday April 24, 2014 @12:54PM (#7641442)
Why is it confusing? It's a basic port of that proprietary database to JavaScript. It's not like it's something completely unrelated.
Re:DataScript – Datomic in ClojureScript by sethev on Thursday April 24, 2014 @01:08PM (#7641527)
In the same way that OracleScript would be an odd choice of name for a SQL database implemented in JavaScript. Now that I say that, though, I guess there isn't really a name for what Datomic is except Datomic.
Re:DataScript – Datomic in ClojureScript by skybrian on Thursday April 24, 2014 @12:43PM (#7641367)
I had no idea what this was, but after some wandering I found some background: http://en.wikipedia.org/wiki/Datalog

Datalog is apparently a subset of Prolog that's used by Datomic (a commercial database) as its query language.

Re:DataScript – Datomic in ClojureScript by danneu on Thursday April 24, 2014 @03:46PM (#7642506)
Here's a quick introductory resource: http://www.learndatalogtoday.org
Re:DataScript – Datomic in ClojureScript by cjo on Thursday April 24, 2014 @05:05PM (#7642984)
The SICP lectures on logic programming will provide some conceptual background if needed.

http://ocw.mit.edu/courses/electrical-engineering-and-comput...

Re:DataScript – Datomic in ClojureScript by sdegutis on Thursday April 24, 2014 @11:30AM (#7640884)
Looks great. I could see using this for some data crunching client-side, maybe even in conjunction with something like graph.js.
Re:DataScript – Datomic in ClojureScript by jchrisa on Thursday April 24, 2014 @04:34PM (#7642790)
Are there any examples of using this from a JavaScript-mostly app? I can see it being useful as a way to clean up existing "global variable" apps.
Re:DataScript – Datomic in ClojureScript by tonsky on Friday April 25, 2014 @01:55AM (#7644944)
There isn’t—yet—but it’s a popular request and I’m now thinking it could be made accessible from JS pretty easily
Re:DataScript – Datomic in ClojureScript by gcv on Thursday April 24, 2014 @01:17PM (#7641571)
Curious: why is this limited to ClojureScript? I can see this being useful in JVM Clojure in projects which do not need real or full Datomic.
Re:DataScript – Datomic in ClojureScript by coolsunglasses on Thursday April 24, 2014 @05:26PM (#7643144)
Why even limit it to Clojure and ClojureScript? I could use this from JavaScript or PureScript as an immutable local store to replicate/merge with the backend asynchronously.
Re:DataScript – Datomic in ClojureScript by cjo on Friday April 25, 2014 @12:16AM (#7644751)
The query language is embedded in legal Clojure data structures, so it would be tricky to port to JS. That's a drawback of embedded DSL's I suppose.
Re:DataScript – Datomic in ClojureScript by coolsunglasses on Friday April 25, 2014 @01:53AM (#7644938)
Contingent on the design but not necessary. I could make something similar in PureScript.

I wouldn't use Datalog though, I got turned off on it after using Datomic at work.

Re:DataScript – Datomic in ClojureScript by tonsky on Friday April 25, 2014 @02:02AM (#7644958)
Similar to Datomic, which has Java bindings and allows for query DSL be specified just as a regular String, we can do this for JS interop
Re:DataScript – Datomic in ClojureScript by Skinney on Thursday April 24, 2014 @11:49PM (#7644666)
From what I can see, DataScript is in-memory only. Wouldn't that be the same as downloading Datomic-free and creating an in-memory db?
Re:DataScript – Datomic in ClojureScript by shaunxcode on Thursday April 24, 2014 @01:38PM (#7641699)
he actually has a clj version in the src. https://github.com/tonsky/datomicscript/blob/master/src/dato...
Re:DataScript – Datomic in ClojureScript by tonsky on Friday April 25, 2014 @01:58AM (#7644953)
It was commited accidentally. Yes, it may be translated to clojure. However, I still don’t know if I should do it, given we have in-memory db bundled with Datomic free client jar.
Re:DataScript – Datomic in ClojureScript by gcv on Saturday April 26, 2014 @11:09AM (#7651609)
Isn't your work released under a less restrictive license than main Datomic?
Re:DataScript – Datomic in ClojureScript by dj-wonk on Thursday April 24, 2014 @10:38PM (#7644456)
How about another rename? DatomicScript was clearly a bad idea and possibly infringing. "DataScript" is just misleading. Using "_____Script" creates the appearance that is a scripting language. Perhaps "_____DB" or "_____JS" would be better.
Re:DataScript – Datomic in ClojureScript by dj-wonk on Thursday April 24, 2014 @10:43PM (#7644470)
How about "NotDatJS" (short for the "Not Datomic" JS Database)?