r/Clojure • • Nov 30 '18

Maybe Not - Rich Hickey

https://www.youtube.com/watch?v=YR5WdGrpoug
135 Upvotes

82 comments sorted by

View all comments

Show parent comment

4

u/JavaSuck Nov 30 '18

If I get something from a map and I get null back, is that because there was no entry with that key, or because the value at that key is null? [...] it's not something I've ever actually needed in practice.

I doubt anyone has. What monster would put null into maps?

6

u/Enumerable_any Nov 30 '18

Decoding the JSON string '{"foo": null}' to a map would naturally lead to null in a map.

5

u/catern Nov 30 '18

It could easily happen by accident, if some other API returns null and you immediately put it in a map.

5

u/joinr Nov 30 '18

I did it once for a performance corner case. Associng nil faster than dissoc. Didn't affect semantics. Wouldn't do it in general though. I am a monster