Re: Any downside of record compared to map

2012-07-23 Thread Sean Corfield
On Mon, Jul 23, 2012 at 1:47 PM, Lee Spector wrote: > On Jul 23, 2012, at 4:06 PM, Aravindh Johendran wrote: >> Are struct-maps really deprecated? It's a good question. Christophe Grand thinks they're "half deprecated" here: http://www.adrianmouat.com/bit-bucket/2011/02/common-lisp-clojure-and-e

Re: Any downside of record compared to map

2012-07-23 Thread Warren Lynn
Thank everybody for the discussion. I am now aware of some pitfalls in using defrecord. For me, I like to have type information associated with my data. I still prefer defrecord over map in general, but I will proceed with more caution. I think some pitfalls here are not due to the greatness o

Re: Any downside of record compared to map

2012-07-23 Thread Lee Spector
On Jul 23, 2012, at 4:06 PM, Aravindh Johendran wrote: > Are struct-maps really deprecated? I don't see a deprecation warning anywhere > (clojure website, source, api, etc.). All I see is the following line in > clojure website. > ---> Note: Most uses of StructMaps would now be better served by

Re: Any downside of record compared to map

2012-07-23 Thread Phil Hagelberg
On Mon, Jul 23, 2012 at 11:59 AM, Ben Mabey wrote: > Another downside I have ran into that hasn't been mentioned is with (Java) > serialization. If you are using records and defining protocols inline you > can serialize the record just fine, however if you change the implementation > then all of

Re: Any downside of record compared to map

2012-07-23 Thread Aravindh Johendran
On Monday, July 23, 2012 8:20:40 AM UTC-4, Lee wrote: > > > Considering that maps do have upsides compared to records in some cases > (as indicated, e.g., by Chas's flowchart), and that struct-maps add a > couple of handy features in the context of some uses of maps, can anybody > say why stru

Re: Any downside of record compared to map

2012-07-23 Thread Ben Mabey
On 7/22/12 5:42 PM, Warren Lynn wrote: I plan to change all my major data structures to records instead of plain maps. Since record has everything a map provides, I figure there won't be any harm. But is that really so? Would appreciate the opinions from people who know better. Another downs

Re: Any downside of record compared to map

2012-07-23 Thread Lee Spector
Considering that maps do have upsides compared to records in some cases (as indicated, e.g., by Chas's flowchart), and that struct-maps add a couple of handy features in the context of some uses of maps, can anybody say why struct-maps are deprecated? -Lee On Jul 23, 2012, at 1:07 AM, Takah

Re: Any downside of record compared to map

2012-07-23 Thread Bronsa
there's also the reader literal user=> (defrecord foo [bar baz]) user.foo user=> #user.foo{:baz 1 :bar 2} #user.foo{:bar 2, :baz 1} 2012/7/23 Takahiro Hozumi > Baishampayan > I didn't know `map->Foo`. Thank you for the infomation! > > > On Monday, July 23, 2012 2:11:45 PM UTC+9, Baishampayan G

Re: Any downside of record compared to map

2012-07-22 Thread Takahiro Hozumi
Baishampayan I didn't know `map->Foo`. Thank you for the infomation! On Monday, July 23, 2012 2:11:45 PM UTC+9, Baishampayan Ghose wrote: > > On Mon, Jul 23, 2012 at 10:37 AM, Takahiro Hozumi > wrote: > > 2. The construction of record depends on an order of arguments. > > Sometimes, I feel tha

Re: Any downside of record compared to map

2012-07-22 Thread Baishampayan Ghose
On Mon, Jul 23, 2012 at 10:37 AM, Takahiro Hozumi wrote: > 2. The construction of record depends on an order of arguments. > Sometimes, I feel that a lack of construction with key-value style is not > convenient. (defrecord Foo ... will give you `->Foo` & `map->Foo` for free. The second one acce

Re: Any downside of record compared to map

2012-07-22 Thread Takahiro Hozumi
I think defrecord has 5 downsides compared to regular map. 1. The literal of regular map is eye-friendly and portable. However I still don't know how helpful instant literals added in clojure 1.4 is for records. 2. The construction of record depends on an order of arguments. Sometimes, I feel th

Re: Any downside of record compared to map

2012-07-22 Thread Sean Corfield
On Sun, Jul 22, 2012 at 8:54 PM, Warren Lynn wrote: > Could you elaborate a little bit more? I know there is a chart, but the > chart does not tell you why. Hmm, I thought the flowchart gave pretty good reasons, sorry :( Records aren't as flexible and you'll lose the type anyway when general map

Re: Any downside of record compared to map

2012-07-22 Thread Warren Lynn
I don't think you're in the minority. I prefer regular maps to records > in general. struct-map was deprecated "a long time ago" (in Clojure > 1.2). clojure.java.jdbc stopped using struct-map a while back - at the > recommendation of Clojure/core - in favor of regular maps. > > Chas Emerick's

Re: Any downside of record compared to map

2012-07-22 Thread Sean Corfield
On Sun, Jul 22, 2012 at 6:25 PM, Lee Spector wrote: > I know I'm in the minority but I happen to prefer maps to records, and in > fact I really like struct-maps which I gather may (?) not be long for this > world. Nonetheless, since you asked, following are two old messages in which > I attempt

Re: Any downside of record compared to map

2012-07-22 Thread Lee Spector
On Jul 22, 2012, at 7:42 PM, Warren Lynn wrote: > I plan to change all my major data structures to records instead of plain > maps. Since record has everything a map provides, I figure there won't be any > harm. But is that really so? Would appreciate the opinions from people who > know better.