I originally posted
<https://stackoverflow.com/questions/63231270/accessing-record-fields-with-keywords-in-clojurescript-not-working-as-in-clojure>
this on StackOverflow.
When I try this:
```clojure
(defrecord Attr [has-default default])
(def attr (->Attr true 1))
(get attr :default) ;;=> 1
(:default attr) ;;=> ClojureScript returns nil, Clojure returns 1
```
Is the difference in behavior when using keyword access expected? I
couldn't find anything about it in the [docs][1] on the differences
between Clojure and ClojureScript.
**Update 2020-08-04**
Well, this is getting weird. This morning, if I open a REPL with
figwheel-main, or from CIDER, it sometimes works as expected -- `(:default
attr)` returns 1.
If I try it by opening the ClojureScript REPL using `clj`, it is still
broken.
```clojure
% clj --main cljs.main --repl
ClojureScript 1.10.773
cljs.user=> (defrecord Attr [has-default defaut])
cljs.user/Attr
cljs.user=> (def attr (->Attr true 1))
#'cljs.user/attr
cljs.user=> (get attr :default)
nil
cljs.user=> (:default attr)
nil
cljs.user=> (:has-default attr)
true
cljs.user=> (println "attr: " attr)
attr: #cljs.user.Attr{:has-default true, :defaut 1}
nil
```
[1]: https://www.clojurescript.org/about/differences#_data_structures
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/clojure/5dd44871-3915-4d80-a959-28be44c8cc32o%40googlegroups.com.