Hi

On 24 November 2010 04:43, Zach Tellman <ztell...@gmail.com> wrote:
> There are a couple of different things being discussed here.  I don't
> think there's any harm in allowing maps as frames, as long as people
> understand that they're arbitrarily ordered (alphabetically by key,
> but that's an implementation detail) and that keys specified aren't
> optional - if they're not all there, the encoder will fail.
>
> The first issue you raised was that we might want to have finer
> control over how maps are encoded, so that we can ensure compatibility
> with C structs.  This is true, but we still want the decoded versions
> of these ordered lists to be maps, because {:a 1, :b 2} is much more
> convenient than [:a 1 :b 2] or [[:a 1] [:b 2]].
>
> The second issue you're raising is backwards compatibility.  It's

I don't think he's talking about backwards compatibility at all.

Assume you have two C structs that you need to interoperate with.  The
first has a few fields and the second has many fields.  If you specify
the format with a map, then when you serialise your Clojure data, the
smaller one will create the values in the order you specified in the
map.  The larger one will be in some arbitrary order which depends on
Clojure's implementation and will likely not match up with the actual
struct definition.

Or to put it another way, say you have many structs.  The first
several have few fields, so you happily use maps to specify them.
Everything works fine.  Then you get to a larger struct and you find
that your fields land up in the wrong part of the serialised output.

I haven't looked at Gloss yet, so maybe this isn't possible for some reason?

> [...] I wrote the
> library mostly to help me write Redis and AMQP clients, but I'm hoping
> people will find it useful for a variety of purposes.

I have used Python's struct library a few times (and perl's
pack/unpack once or twice), so I'm sure Gloss would be useful for the
same sorts of things.

-- 
Michael Wood <esiot...@gmail.com>

-- 
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

Reply via email to