Fork me on GitHub
#datascript
<
2016-11-25
>
leov11:11:56

Ok, one more strange question - if I want to preserve history in datascript, I just store old values in persistent vector [db1, db2, db3, ..]

leov11:11:34

but if I store then vector to disk, and reload it back again, it will eat up much more memory, right? there is no way to serialize structural sharing in underlying datastructures?

leov11:11:45

(if I am getting this at all)

Niki11:11:30

You're right @leov

leov11:11:52

many thanks

leov11:11:24

I wish I would be in shape one day to combine datascript and drgnbrg outboard project 🙂

joost-diepenmaat14:11:21

if I want to :db/retract an attribute but specify a value of a different type than the current value, I get a class cast exception

joost-diepenmaat14:11:29

is that something that should be fixed?

joost-diepenmaat14:11:59

usecase here is that the current db’s value is a lookup ref, and I accidentally provided a string instead.

Niki14:11:52

to retract an attribute, you cannot provide anything but the current value

Niki14:11:21

or maybe I don’t understand what your problem is

Niki14:11:53

is current value a string or a lookup ref (vector, right?). What have you provided for that attribute in schema?

Niki14:11:11

what you want it to be?

Niki14:11:34

are there other values in db under the same attribute? Are they of different type or the same one?

Niki14:11:05

(but easiest way to fix that is just to recreate a DB and don’t put what you don’t want to be there)

joost-diepenmaat14:11:07

the problem is that if I make a mistake and provide the wrong value of the wrong type in a retract transaction, that will cause an exception

joost-diepenmaat14:11:48

so far I’ve not attempted to build a system that uses multiple types of value for the same attribute, but I’m assuming that would cause an exception too

joost-diepenmaat14:11:03

the main problem is that it’s very hard to figure out what was happening at all.

joost-diepenmaat14:11:48

I would probably be happier if the retraction just had no effect if the values don’t match, regardless of type

joost-diepenmaat14:11:08

the current value is a vector (lookup ref) with matching {:db/unique :db.unique/identity} schema

joost-diepenmaat14:11:01

but the provided value is someting like [:db/retract eid :something/else “my-id”] instead of [:db/retract eid :something/else [:my/ref “my-id”]]

joost-diepenmaat15:11:09

so that’s a mistake on my part. I just found it hard to figure out what the problem was at all given java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IPersistentVector

misha16:11:51

@joost-diepenmaat it is not a good idea to have something fail silently on a library level.

Niki16:11:15

Yeah, failing there early allowed you to find an error in a code. I consider that to be a good thing

Niki16:11:26

ClassCastException is puzzling though, of course

Niki16:11:39

I know it might be hard to figure out those

leov20:11:12

>_< um.. so full datomic does not have dynamic schema?