Last active
August 29, 2015 14:13
-
-
Save domkm/a92d8d33db4d8355139c to your computer and use it in GitHub Desktop.
ClojureScript reads records as maps. Bug?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns namespace) | |
(defrecord Language [name]) | |
(defmacro lang [name] | |
(->Language name)) | |
(def clj | |
(lang "Clojure")) | |
;; Clojure reads the emission of the macro as a record | |
clj | |
;=> #namespace.Language{:name "Clojure"} | |
(type clj) | |
;=> namespace.Language |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns namespace | |
(:require [cljs.reader]) | |
(:require-macros [namespace :refer [lang]])) | |
(defrecord Language [name]) | |
;; This does not fix the issue below. | |
; (cljs.reader/register-tag-parser! "namespace.Language" map->Language) | |
(def cljs | |
(lang "ClojureScript")) | |
;; ClojureScript reads the emission of the macro as a map | |
cljs | |
;=> {:name "ClojureScript"} | |
(type cljs) | |
;=> cljs.core/PersistentArrayMap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment