4 ms·
I came away with a different interpretation of Rich Hickey’s talk. I think he was advocating against using slots, where a slot would be a struct field. A slot h
by jbritton 3y ago
I came away with a different interpretation of Rich Hickey’s talk. I think he was advocating against using slots, where a slot would be a struct field. A slot has to have a value and if a value is not available then null is put there and now null must be dealt with. Instead I think he was advocating for using dictionaries. You either have a key or you don’t, but you never use null. However it seems that now you would have a bunch of “key in dict” checks which are less efficient than “value is null” checks. Plus confusion about what exactly has been supplied in a dictionary. Although there may be cases where code can just sequence through what exists without worrying about what doesn’t exist.
- Sakos 3y agoI think the fact that it's impossible to know what could be in a dictionary without explicitly checking makes dicts an awful solution. A lot of times I'll encounter functions that take maps, but I'll have to reverse engineer the surrounding code (and if I'm particularly unlucky, a related service) to figure out what goes in there. I'll take explicit types over dicts any day.