Fork me on GitHub
#xtdb
<
2021-12-21
>
xlfe05:12:14

lost a bit of time on this "trap for young players" today :rolling_on_the_floor_laughing:

(let [d 1                                                                                                
      node (xt/start-node {})]                                                                           
    (xt/await-tx                                                                                           
      node                                                                                                 
      (xt/submit-tx                                                                                        
        node                                                                                               
        [                                                                                                  
         [::xt/put {:xt/id {:n (int d)}}]                                                                 
         [::xt/put {:xt/id (int d)}]]))                                                                    
    (let [db (xt/db node)]                                                                                 
      [                                                                                                    
        (xt/entity db d)                                                                                   
        (xt/entity db {:n d})]))                                                                          
result:
[{:xt/id 1} nil]

xlfe05:12:13

it's not a bug, but an artifact of

[                                                                                                      
 (=                                                                                                    
   (c/new-id {:x (int 1)})                                                                             
   (c/new-id {:x (long 1)}))                                                                           
 (=                                                                                                    
   (c/new-id (int 1))                                                                                  
   (c/new-id (long 1)))])                                                                                
result
[false true]

refset12:12:07

oh dear, interesting though! This is a side-effect of how we use Nippy. The equality semantics of maps is already complicated enough 🙈

refset12:12:28

sorry for the sharp edge!

Steven Deobald15:12:17

@U01ENMKTW0J If you're keen to install signposts which warn future youthful travellers, this is definitely the sort of thing that could go on http://discuss.xtdb.com where the googles and ducks can find them. 🙂 (As always, no obligation.)

👍 1
lepistane21:12:15

Cross posting but i am not even sorry https://clojurians.slack.com/archives/C02BJCKN0R4/p1640120358230800 Thank youuuuu ❤️

🙂 2
🙌 2
refset21:12:24

It's nice to hear this feedback, so thank you! Out of interest, did you work through things in your local REPL, or did you stick to the Nextjournal UI? (and should I point out that their team deserve a lot of credit for building such a great platform for us all to use ~freely 🙂)

lepistane22:12:59

Combination of both. At first i was using REPL but realized there was no need NextJournal UI did everything i needed!

1