core.async

Record literals become ordinary maps

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    CLJS
  • Approval:
    Triaged

Description

(require '[clojure.core.async :refer (<!! go)])
(defrecord Foo [x])
(def f (Foo. 4))
(<!! (go f))
;; => #user.Foo{:x 4}
;; OK

(<!! (go #clojure.core.async.Foo{:x 4}))
;; CLJ: => #user.Foo{:x 4}   ;; expected
;; CLJS => {:x 4}            ;; wrong

Approach: Query the analyzer to know if we have a record or not.

(Copied from GitHub issue #13 - https://github.com/clojure/core.async/issues/13)

Activity

Alex Miller made changes -
Field Original Value New Value
Description {code}clojure.core.async> (defrecord Foo [x])
clojure.core.async.Foo{code}

Works:
{code}clojure.core.async> (def f (Foo. 4))
#'clojure.core.async/f
clojure.core.async> (<!! (go f))
#clojure.core.async.Foo{:x 4}{code}

Turns record into a map:
{code}clojure.core.async> #clojure.core.async.Foo{:x 4}
#clojure.core.async.Foo{:x 4}
clojure.core.async> (<!! (go #clojure.core.async.Foo{:x 4}))
{:x 4}{code}


(Copied from GitHub issue #13 - https://github.com/clojure/core.async/issues/13)

{code}clojure.core.async> (defrecord Foo [x])
clojure.core.async.Foo{code}

Works:
{code}clojure.core.async> (def f (Foo. 4))
#'clojure.core.async/f
clojure.core.async> (<!! (go f))
#clojure.core.async.Foo{:x 4}{code}

Turns record into a map:
{code}clojure.core.async> #clojure.core.async.Foo{:x 4}
#clojure.core.async.Foo{:x 4}
clojure.core.async> (<!! (go #clojure.core.async.Foo{:x 4}))
{:x 4}{code}

Hide
Ghadi Shayban added a comment -

0c6e663493 contains a fix on the Clojure side, would appreciate help porting to cljs.

Show
Ghadi Shayban added a comment - 0c6e663493 contains a fix on the Clojure side, would appreciate help porting to cljs.
Hide
David Nolen added a comment -

I think on the ClojureScript we'll have to query the analyzer to know if we have a record or not.

Show
David Nolen added a comment - I think on the ClojureScript we'll have to query the analyzer to know if we have a record or not.
Rich Hickey made changes -
Assignee Rich Hickey [ richhickey ]
Alex Miller made changes -
Approval Triaged [ 10120 ]
Description (Copied from GitHub issue #13 - https://github.com/clojure/core.async/issues/13)

{code}clojure.core.async> (defrecord Foo [x])
clojure.core.async.Foo{code}

Works:
{code}clojure.core.async> (def f (Foo. 4))
#'clojure.core.async/f
clojure.core.async> (<!! (go f))
#clojure.core.async.Foo{:x 4}{code}

Turns record into a map:
{code}clojure.core.async> #clojure.core.async.Foo{:x 4}
#clojure.core.async.Foo{:x 4}
clojure.core.async> (<!! (go #clojure.core.async.Foo{:x 4}))
{:x 4}{code}

{code}
(require '[clojure.core.async :refer (<!! go)])
(defrecord Foo [x])
(def f (Foo. 4))
(<!! (go f))
;; => #user.Foo{:x 4}
;; OK

(<!! (go #clojure.core.async.Foo{:x 4}))
;; CLJ: => #user.Foo{:x 4} ;; expected
;; CLJS => {:x 4} ;; wrong
{code}

*Approach:* Query the analyzer to know if we have a record or not.

(Copied from GitHub issue #13 - https://github.com/clojure/core.async/issues/13)
Environment CLJS
Summary record literals become ordinary maps Record literals become ordinary maps

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: