From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: protobuff for Ada Date: Sat, 29 Dec 2018 12:05:40 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <177bddd8-297e-4c5f-85aa-31cd694e68b4@googlegroups.com> NNTP-Posting-Host: i065DRYuysvTI4qVnaNkyg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.3 Xref: reader01.eternal-september.org comp.lang.ada:55117 Date: 2018-12-29T12:05:40+01:00 List-Id: On 2018-12-29 06:53, Shark8 wrote: > Though, it should be noted that ASN.1 is *probably* the better technology in cases where ProtoBufs are being considered: > http://ttsiodras.github.io/asn1.html Sorry to disappoint you in this festive time, but this approach has the same fundamental flaw as prepared SQL statements do. You have to bind native Ada objects to protocol/serialized/persistent objects forth and back. This does not work well in practice. In fact, it barely work at all considering the overhead and hazards of type conversions. A different approach is Ada's representation clauses which describe both objects same. Beyond simple textbook cases that does not work either. The best practical method so far is using manually written stream attributes. Unfortunately it has shortcomings too: 1. Reuse is limited and composition is unsafe because stream attributes are non-primitive operations. 2. Introspection is almost non-existed. Only tagged types could have it. 3. No support of error handling and versioning. Though it is possible to do manually that is extremely error-prone and totally lacks static verification when the number of test cases is huge to potentially infinite. Even worse, the offending cases do not show up in a normally functioning system. So, when detected, it is always too late. P.S. Needless to say, the problems 1-3 fully apply to other two methods as well. P.P.S. And nothing was said about referential and recursive types... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de