With regard to mistyped keys in general, a simple option is to use named keys; then the compiler will flag undefined ones. (def k :key) ... (k m)
On Apr 21, 10:44 pm, Christian Schuhegger <christian.schuheg...@gmail.com> wrote: > I am taking up a discussion from > 2010:https://groups.google.com/group/clojure/browse_frm/thread/60dff89149c... > > I would prefer if it would be possible to define "closed maps", e.g. > maps that allow only a certain set of keywords, both for get and > "set" (like in assoc, assoc-in, update-in, ...). It would be nice if > there would be an option on defrecord to mark the map as "closed". > > I imagine that this would have some runtime penalty, because for every > access it has to be verified if the key is a valid one. I understand > that. Perhaps in that case the language could react differently based > on the value of a dynamic var (*check-closed-defrecrod-p*) that can be > set when the unit tests are run and could be false by default. > > I guess this topic was already discussed several times. Could somebody > point me to previous discussions and their outcome? > I've found in addition the following thread where the idea of "safe > maps" was discussed to some > extent:https://groups.google.com/group/clojure/browse_frm/thread/134642cc76d... > > Thanks, > Christian -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en