Fork me on GitHub
#datascript
<
2016-11-29
>
timgilbert04:11:58

Say, can anyone tell me what the difference is between (d/transact) and (d/transact!) ?

leov05:11:16

well, in ruby that would be throws-exception vs exceptionless, but here.. need to read code 🙂

leov05:11:07

also, I've just installed ds-transit. to my first impression, the only difference of transit to JSON here is the appearance of custom data types, methinks

leov05:11:22

ok, @timgilbert , according to the sources of datascript transat is the same as transact!, but wraps the result into deferrable

leov05:11:56

or how is it called? when you need to apply @ (aka deref) to the result to get the value

leov05:11:33

dereffable 🙂

timgilbert06:11:08

Oh, that makes sense, it’s the same API as in datomic then. Thanks for looking @leov

tonsky06:11:56

transact! is DataScript way to do transaction, exclamation mark means side effects (same everywhere in Clojure)

tonsky06:11:11

transact was added to be compatible with Datomic API

tonsky06:11:29

basically the same, wrapped in a dereffable, same as in Datomic

tonsky06:11:09

difference between Transit and JSON is that it keeps Clojure types

tonsky06:11:35

for DataScript, it means it keeps datoms and can even serialize full DB through custom type serializer

tonsky06:11:05

transit do optimize repeated keywords

misha06:11:02

@tonsky any plans to support today's datomic changes (optional temp ids and whatnot)?

misha06:11:39

(no idea why am asking, actually)

tonsky06:11:43

tempids are optional already

leov06:11:54

also, someone, any plans to combine datascript engine with https://github.com/datacrypt-project/hitchhiker-tree?)

tonsky06:11:56

string ones are new though

leov06:11:14

so you're saying transit already optimize repeated keywords?

tonsky06:11:23

I’d love to do all that, but can’t get enough time unfortunately

leov06:11:40

I will try if I have time, but currently my clojure experience is no match for the task

leov06:11:01

also need to learn big datomic brother more. I currently know only datascript api)

leov06:11:08

and struggling to plug datomic in

misha06:11:20

@leov for serialization - transit is ❤️

leov06:11:25

omg. wow

leov06:11:35

also last question

leov06:11:02

Nikita, you mentioned there were some drawbacks in making datascript umm using underlying storage, even in browser

leov06:11:14

can you mention specifics, if you have?

misha06:11:00

@tonsky by "plans", I meant something like "comment on whether it is feasible/(im)possible/worth it with current architecture".

tonsky06:11:10

I only remember mentioning that it was not designed to work with async storages like IndexedDB

misha06:11:31

just matching any datomic feature within js environment easily might not be the best idea

tonsky06:11:39

@misha oh I’m sure it’s worth it

tonsky06:11:51

I like string tempids

tonsky06:11:00

much better than negative numbers I think

tonsky06:11:07

more meaning

misha06:11:41

how much more expensive would be to get straight to recognize new lookup refs within same transaction?

tonsky06:11:07

what’s that?

tonsky06:11:25

I think DS already does that, Datomic does not (still)

tonsky06:11:33

if I understand you correctly

misha07:11:40

like, why would you use

[{:db/id "that guy"   ; new user
  :user/email ""} ; user's unique identity
 {:user/email "" ; existing user
  :user/friends "that guy"}] ;string temp id 
instead of just:
[{:user/email ""} ; new user
 {:user/email ""} ; lookup ref to existing user
  :user/friends [:user/email ""]] ;new user's lookup ref

misha07:11:25

probably : > can't say it does not.

tonsky07:11:45

yeah, that stuff is DataScript only

tonsky07:11:06

but you have to use [] instead of {}

misha07:11:22

oh cool. so it is already implemented. I'm good to go then kappa

misha07:11:14

then I don't see any point in implementing string temp ids, id is the only unique attribute on the entity (yeah, that'd be the use case)