From mboxrd@z Thu Jan 1 00:00:00 1970 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: In memory Stream Date: Thu, 22 Feb 2024 09:54:07 +0100 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 22 Feb 2024 08:54:07 -0000 (UTC) Injection-Info: dont-email.me; posting-host="8b66236a3cc5eecc157070ba6226642a"; logging-data="3984244"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/k+Zx8+gmZQV/QleIlTzHSn1zhzwF/dg=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:NPbcF9wOqDtY0tgJSJRmYJ8aa30= Content-Language: en-US In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:66117 List-Id: On 2024-02-21 20:44, Lawrence D'Oliveiro wrote: > On Wed, 21 Feb 2024 08:43:13 +0100, Dmitry A. Kazakov wrote: > >> On 2024-02-20 23:32, Lawrence D'Oliveiro wrote: >>> On Tue, 20 Feb 2024 21:45:46 +0100, Dmitry A. Kazakov wrote: >>> >>>> The burden of checks is moved to the application, the format is same. >>> >>> Isn’t that how all formats are implemented? >> >> There is a difference in semantics of checks. > > Think of a stream of bytes as the ultimate meta-format. Of course not. It is not a format it is a transport layer. [ BTW, it is not bytes, it is octets actually ] > All extra layout > on top of that is “moved to the application”, as you say. But it just > takes more work starting from such a low level; starting from a higher > point, like JSON, reduces that work. Not at all. Implementation of serialization/deserialization on top of JSON is exponentially harder than on top of an octet stream. Alone specification of handling missing, superfluous, wrongly typed fields is a huge work before a single line of code is written. Furthermore, 1. JSON is unable to represent basic data, like time stamps. These must be encoded as strings accompanied with parsing and checks. Compare that with encoding as octets. 2. JSON is not extensible in any sense. You cannot add new syntax elements to JSON. 3. There is no any abstraction by which you could reuse JSON encoding. I.e. this element is like that element. Repeat this by number of times specified by that. 4. Nor JSON supports extensions objects. Compare it with Ada's extension aggregates: http://ada-auth.org/standards/rm12_w_tc1/html/RM-4-3-2.html#I2535 5. JSON cannot specify constraints, like value ranges, precision, variable record fields, array bounds. 6. JSON has no means of reflection. Talking about "metas", there is no way to convey a JSON description of an object (rather than instance = data) to another node. Both sides must know each other prior to communication. I don't say that dynamic binding is a good idea for communication for for tall claims made and all immense overhead involved... JSON is an extremely crude primitive hobbyish idea a lazy undergraduate in horticulture might have about a communication protocol... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de