Re: deftype comment

2010-02-15 Thread Rich Hickey
On Mon, Feb 15, 2010 at 3:56 AM, Konrad Hinsen wrote: > On 14.02.2010, at 22:48, Mark Engelberg wrote: > >> Actually, the more I think about it, the more I feel like deftype's >> "specify clojure.lang.IPersistentMap as an interface with no >> implementation, and you'll get a default implementation

Re: deftype comment

2010-02-15 Thread Konrad Hinsen
On 14.02.2010, at 22:48, Mark Engelberg wrote: > Actually, the more I think about it, the more I feel like deftype's > "specify clojure.lang.IPersistentMap as an interface with no > implementation, and you'll get a default implementation" seems like a > weird exception, I agree. The current defty

Re: deftype comment

2010-02-14 Thread Mark Engelberg
Actually, the more I think about it, the more I feel like deftype's "specify clojure.lang.IPersistentMap as an interface with no implementation, and you'll get a default implementation" seems like a weird exception, and I can't help but wonder if there's a more general way to handle it that would h

Re: deftype comment

2010-02-14 Thread Mark Engelberg
On Sun, Feb 14, 2010 at 8:56 AM, Stuart Sierra wrote: > Rich's stated reason against this is that he wants to be able, some > day, to implement maps and map-like things with deftype. Hmmm, if so, then there's a bit of a design tension between that goal and the goal of "prefer deftype to defstruct

Re: deftype comment

2010-02-14 Thread Stuart Sierra
On Feb 14, 1:53 am, Mark Engelberg wrote: > I think it would be ideal that if you *don't* > specify clojure.lang.IPersistentMap as an interface, you still get an > implementation of assoc that works only with keys already in the type. ... > Thoughts? Rich's stated reason against this is that he w

Re: deftype comment

2010-02-14 Thread Konrad Hinsen
On 14.02.2010, at 07:53, Mark Engelberg wrote: > After playing around, I think it would be ideal that if you *don't* > specify clojure.lang.IPersistentMap as an interface, you still get an > implementation of assoc that works only with keys already in the type. > In other words, you can't add a ne

Re: deftype comment

2010-02-13 Thread Mark Engelberg
Yes, that's what I meant :) . On Sat, Feb 13, 2010 at 11:27 PM, Brendan Ribera wrote: > >> You should be able to do (assoc p :x 3), you should get back #:Posn{:x >> 1, :y 2} > > You meant that you get back #:Posn{:x 3, :y 2}, right? Sounds reasonable to > me. > > -- > You received this message be

Re: deftype comment

2010-02-13 Thread Brendan Ribera
You should be able to do (assoc p :x 3), you should get back #:Posn{:x 1, :y 2} You meant that you get back #:Posn{:x 3, :y 2}, right? Sounds reasonable to me. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

deftype comment

2010-02-13 Thread Mark Engelberg
I was doing some experimenting with deftypes this evening. I understand that you need to specify clojure.lang.IPersistentMap as an interface in order to make your type behave like a general-purpose map (supporting assoc, dissoc, etc.). After playing around, I think it would be ideal that if you *