I verified the problem in the StackOverflow post.  For some reason keyword
lookup of record fields in CLJS doesn't work.
Alan

On Tue, Aug 4, 2020 at 12:05 PM Justin Smith <noisesm...@gmail.com> wrote:

> I don't think this is true, or if true is incidental to the real problem
>
> % cljs
> ClojureScript 1.10.758
> cljs.user=> (defrecord Attr [has-default default])
> cljs.user/Attr
> cljs.user=> (get (->Attr true 1) :default)
> 1
> cljs.user=> (:default (->Attr true 1))
> nil
> cljs.user=>
>
> On Tue, Aug 4, 2020 at 11:53 AM Mark Engelberg <mark.engelb...@gmail.com>
> wrote:
> >
> > You misspelled default in your defrecord.
> >
> > On Tue, Aug 4, 2020 at 7:42 AM 'clartaq' via Clojure <
> clojure@googlegroups.com> wrote:
> >>
> >> I originally posted 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 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
> >> ---
> >> 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 clojure+unsubscr...@googlegroups.com.
> >> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/5dd44871-3915-4d80-a959-28be44c8cc32o%40googlegroups.com
> .
> >
> > --
> > 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
> > ---
> > 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 clojure+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/CAORbMON7N3ukBEn%3D%3DzX8pAz3tJg%2BjX32x4TTDDqYdCxbWDswbA%40mail.gmail.com
> .
>
> --
> 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
> ---
> 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 clojure+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/CAGokn9LpwPYku9606pYXXzLSGQp6aphtsvckjd%3DASG6JEQM2VA%40mail.gmail.com
> .
>

-- 
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
--- 
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 clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAN67zA1Zg41_Rr_sKFPu3fcF8myNPntF%2Bg7_6gieVXbW1R3P8A%40mail.gmail.com.

Reply via email to