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 
objects to be alternative map implementations, and I want mutable fields 
for the transients.

On Thursday, 21 April 2016 16:22:14 UTC-7, tbc++ wrote:
>
> 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. 
>
> Timothy
>
>
> On Thu, Apr 21, 2016 at 5:01 PM, Sean Corfield <se...@corfield.org 
> <javascript:>> wrote:
>
>> Pretty sure Michal Marczyk mentioned this in his Clojure/West talk last 
>> week:
>>
>>  
>>
>>
>> https://www.youtube.com/watch?v=vZtkqDIicqI&index=14&list=PLZdCLR02grLq4e8-1P2JNHBKUOLFTX3kb
>>
>>  
>>
>> (I don’t remember exactly what he said was the workaround)
>>
>>  
>>
>> Sean Corfield -- (904) 302-SEAN
>> An Architect's View -- http://corfield.org/
>>
>> "If you're not annoying somebody, you're not really alive."
>> -- Margaret Atwood
>>
>>  
>>
>> On 4/21/16, 2:05 PM, "JvJ" <clo...@googlegroups.com <javascript:> on 
>> behalf of kfjwh...@gmail.com <javascript:>> wrote:
>>
>>  
>>
>> 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 this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> 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+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking 
> zero–they had no way to indicate successful termination of their C 
> programs.”
> (Robert Firth) 
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to