Yes, there are different concept of [de-]serialization to consider:

One variant is "technically accurate and completely reversible" - this
can be a worthwhile academic exercise. This would let you read
MessagePack content into J, and then regenerate exactly the same
sequence again, regardless of what was sent.

Another variant, though, is "efficient for a specific context" - this
would be a much faster approach which takes short cuts which are
irrelevant for your context. This version, if you used it to
regenerate the information in MessagePack format would not generate an
identical message to the original for some hypothetical messages.

There's some judgement calls here, about what's important and what's
not. Nothing is ever perfect.

That said, there's a final variant to consider, which is the null
transform. Here, you do not transform the MessagePack message at all.
This is, of course, completely reversible and incredibly efficient.
But it can also be silly to call this "serialization".

Thanks,

-- 
Raul


On Fri, Jan 30, 2015 at 10:33 AM, Jon Hough <[email protected]> wrote:
> I imagine that, for my purposes, what this means is since I cannot 
> distinguish a "byte array" from a string literal, that MessagePack 
> serialization will have to be slightly incomplete with regards to binary data.
> Deserialization should not be a problem since, in general, the first byte of 
> the MsgPack data gives the datatype, so  it is easy to distinguish byte data 
> from string data.
>
>> From: [email protected]
>> To: [email protected]
>> Date: Fri, 30 Jan 2015 15:28:42 +0000
>> Subject: Re: [Jprogramming] Byte Arrays vs Integer Arrays
>>
>> So, in J, if I am given a "byte array", e.g.
>> let n =: a.{~ 101 14 29 76 100 NB. just some random values
>>
>> is it possibly to distinguish this from a literal?
>> Doing
>> datatype n
>> gives
>> 'literal'
>>
>> Also is a.{~ essentially casting an int to a char (in C)?
>>
>> > From: [email protected]
>> > Date: Fri, 30 Jan 2015 09:49:42 -0500
>> > To: [email protected]
>> > Subject: Re: [Jprogramming] Byte Arrays vs Integer Arrays
>> >
>> > In J, a byte array is a literal array whose members are elements of
>> > the a. constant.
>> >
>> > That said, the semantics of J are about giving us abstractions which
>> > hold across some different storage formats.
>> >
>> > Meanwhile: if you ask different people "what are the essential
>> > features of a type" you will get different (and yet vigorously
>> > asserted) answers. [This depends on what language(s) they have been
>> > working with, the kinds of problems they have been solving, the nature
>> > of what they expect from other people, and the primary obstacles they
>> > face.]
>> >
>> > Thanks,
>> >
>> > --
>> > Raul
>> >
>> > On Fri, Jan 30, 2015 at 9:28 AM, Jon Hough <[email protected]> wrote:
>> > > As I said in an earlier thread, I am attempting to write a MessagePack 
>> > > implementation in J.
>> > > Spec: https://github.com/msgpack/msgpack/blob/master/spec.md#formats-bin
>> > > Home: http://msgpack.org/
>> > >
>> > > In the spec there must be a way to serialize/deserialize byte arrays. 
>> > > However, in J what is a byte array? And how would you differentiate it 
>> > > from an integer array (0 ~ 255)?
>> > > I may be absolutely mistaken, but there seems to be a little ambiguity 
>> > > between these types in J (well there is no byte type).
>> > >
>> > >
>> > >
>> > >
>> > > ----------------------------------------------------------------------
>> > > For information about J forums see http://www.jsoftware.com/forums.htm
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to