The use of d/tempid

In a lot of tutorials, I see tempid being used where it seems to serve no purpose. Here’s an example from a friendly walkthrough:

(d/transact conn [{:db/id (d/tempid :db.part/user)
                   :owner/name "Bob"
                   :owner/dogs [{:db/id (d/tempid :db.part/user)
                                 :dog/name "Fluffy"

Every time we create a new entity, the example shows :db/id being manually generated. If I take out those lines all the examples still work. It seems like you’d use a temp ID if you were building a transaction where you were creating multiple entities with one transaction, but you weren’t, for whatever reason nesting them (as Gigasquid does in the linked examples).

I see at some point that one couldn’t leave these out and so maybe I’m just looking at old examples. Or is there some magic behind that :db.part/user segment that I’m overlooking?

tempid is no longer required and now can be a string. See the changelog and https://docs.datomic.com/on-prem/transactions.html
Generally you want to have explicit tempid if you have to obtain the newly created entity id(s) after the transaction (from :tempids and maybe following the query on :db-after) or refer it within the transaction, otherwise it can be skipped.

That is correct.
Implicit tempids were added in version 0.9.5530 (https://docs.datomic.com/on-prem/changes.html#0.9.5530).
As blake noticed, you can still use them without any issue, but they’re no longer required.

Marshall, can you confirm that for OnPrem, d/tempid despite being optional is still useful in the circumstances described here: https://docs.datomic.com/on-prem/indexes.html#partitions

That is also correct Dustin.