Re: How to forward-declare deftypes

2016-04-21 Thread JvJ
What I ended up doing was forward-declaring a wrapper to the constructor of the later class. I actually am implementing a protocol, but the concrete types representing the persistent and transient versions need to reference each other. Also, I'm using deftype over defrecord because I want the

Re: How to forward-declare deftypes

2016-04-21 Thread Timothy Baldridge
Few things to consider: code against protocols where possible (removes the need to forward declare methods). Forward declare the constructor functions: (declare ->Foo) ... (defn some-code [] (->Foo 1 2)) (defrecord Foo [x y]) If you need to do type checks check for a protocol instead.

Re: How to forward-declare deftypes

2016-04-21 Thread Sean Corfield
Pretty sure Michal Marczyk mentioned this in his Clojure/West talk last week: https://www.youtube.com/watch?v=vZtkqDIicqI=14=PLZdCLR02grLq4e8-1P2JNHBKUOLFTX3kb (I don’t remember exactly what he said was the workaround) Sean Corfield -- (904) 302-SEAN An Architect's View --

How to forward-declare deftypes

2016-04-21 Thread JvJ
I'm working with two deftypes that I want to be able to references each other. (They're persistent and transient implementations of the same collection.) So far, it seems that the normal clojure.core/declare doesn't work in this case. Is there another way to do it? Thanks -- You received