Hello,

what's the preferred way to override the toString method of a
ClojureScript record? I could use set! to change the toString fn
of a record after it has been initialized like this:

(defrecord MyRecord [name])

(let [record (MyRecord. "Hello World")]
  (set! record.toString (fn [] (:name (js* "this"))))
  (str record))

But I wonder if there is something more idiomatic? Can I change
the toString method in the prototype of the record directly? How
do get the prototype?

Thank you, Roman.

-- 
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

Reply via email to