arrayencode

Richard Gaskin ambassador at fourthworld.com
Tue Jun 21 22:43:30 EDT 2022


l oTom Glod wrote:

 > I am wondering if anyone here knows the encoding algorithm
 > that arrayencode() uses?

Yes.


 > Is it one that can be implemented in another language or is
 > it proprietary?

It should be technically possible to implement any algo in any 
sufficiently-complete language.

Whether LC Ltd considers is proprietary in terms of limiting 
interoperability with other systems is something only they can address.


I have notes on the v6.7-and-earlier format, and it shouldn't be hard to 
figure out the changes for v7-and-later.

But as much as I've enjoyed LSON for LC-to-LC data transfer, I wouldn't 
recommend it as a general-purpose serialization format. Though its 
binary nature makes it similar to BSON in some efficiency areas, the 
world uses JSON for interoperability, and these days that includes even LC.

If you have a use case that truly needs it and can't use 
industry-standard JSON, let me know and I can dig through my archives to 
find the notes I'd assembled years ago from some tips Mark Waddingham 
was generous enough to send.

But you'll want to consider this carefully. Format choices have a way of 
becoming technical debt with surprising ease over time.

For better or worse, the universal de facto standard for serialization 
today is JSON. LC itself is committed to JSON for interoperability, even 
bringing in parts of the ECMAScript parser. JSON is well documented, 
with tons of tooling. And in some ways JSON is a superset of LC's 
associative arrays, so it offers options for expressiveness beyond LSON.

I've had some good times with LSON. But the moment I think of any part 
of the system not made with LC, I think about other formats.

If I needed the efficiency of a binary format, for interoperable work 
I'd consider BSON. Its only drawback is the same as LC's: it's currently 
used by only one tool ;) (MongoDB, though in all fairness it's presented 
as an open standard and may have a few other adopters as well).

https://bsonspec.org/

BSON parsers are available for a great many languages:
https://bsonspec.org/implementations.html

-- 
Richard Gaskin
Fourth World Systems



More information about the use-livecode mailing list