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, Takahiro Hozumi wrote:
> 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 that a lack of construction with key-value style is not
> convenient.
>
> 3. Replacing all regular maps to records simply make code volume increase.
>
> 4. Records easily loose their type.
> (merge {:c 3 :d 4} (Foo. 1 2))
> ;=> {:a 1, :b 2, :c 3, :d 4}
>
> 5. Regular map is a persistent data structure, which has internally efficient
> tree data structure, but record is compiled into class with fields as
> something like POJO.
> I suspect efficiency of record when repeated assoc/dissoc.
>
> But I could be wrong.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en