|
|
|
|
|
by dominotw
2490 days ago
|
|
> Everything is hashmap-typed and you need to do runtime checks to make sure the data you receive is what you expect. You cannot trust any input I don't mean this in a type system flamewar but in java if you receive Person object and want to get firstName. Your options are still the same. 1. runtime check to see person.firstName is not null. 2. or blindly assume that it can never be null and do person.firstName.trim() So those are the exact options in clojure too. What am I missing here. |
|
person?.firstName?.trim();
What (s)he means though is in Java if firstName is there then it will be a string.
In Clojure firstName might be anything, a string, a number or even an entire other hashmap or type, literally anything. This might or might not cause a runtime crash if you are doing something that assumes it's a string. So you check.