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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,29d8139471e3f53e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Securing type extensions Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <87iq2bfenl.fsf@mid.deneb.enyo.de> <874odv9npv.fsf@ludovic-brenta.org> <87y6b7cedd.fsf@mid.deneb.enyo.de> <66a3704c-54f9-4f04-8860-aa12f516134b@t3g2000vbb.googlegroups.com> <87d3sib44t.fsf@mid.deneb.enyo.de> <134q4k2ly2pf4$.17nlv1q6q5ivo.dlg@40tude.net> <4c8dec8e$0$6990$9b4e6d93@newsspool4.arcor-online.net> <4c8e3f44$0$6769$9b4e6d93@newsspool3.arcor-online.net> <4c8e87f8$0$6877$9b4e6d93@newsspool2.arcor-online.net> <4c8f4833$0$6763$9b4e6d93@newsspool3.arcor-online.net> <2ka8sfdvyvil.1k714obgzgj3a.dlg@40tude.net> <4c8fe6ad$0$6759$9b4e6d93@newsspool3.arcor-online.net> Date: Wed, 15 Sep 2010 10:15:55 +0200 Message-ID: <1dd5fjdnyl5ek.1ju0bvot51loy.dlg@40tude.net> NNTP-Posting-Date: 15 Sep 2010 10:15:46 CEST NNTP-Posting-Host: f3e53600.newsspool4.arcor-online.net X-Trace: DXC=f[O9<5D]SUR\9P[:DUn00Q4IUK On Tue, 14 Sep 2010 23:18:36 +0200, Georg Bauhaus wrote: > On 9/14/10 2:22 PM, Dmitry A. Kazakov wrote: >> On Tue, 14 Sep 2010 12:02:28 +0200, Georg Bauhaus wrote: >> >>> I'm asking about visibility and how it can possibly help ascertaining >>> that user supplied subprograms are trustworthy---which is, by >>> definition, not the same thing as "safe". >> >> Hmm, how "trustworthiness" corresponds to correctness and type safety? > > I'd consider the relation of trustworthiness, correctness and type > safety at least from two viewpoints, a technical one and one on > conflict: > > 1 - Technically, a program may have certain formal properties, > such as no type errors. (Like a program can suffer if written > in Python). Each formal property may exclude precisely the > corresponding class of errors, if there is such correspondence. > > Suppose a partial program has "sockets" into which foreign code > can be plugged, to make it complete. Such as a type extension > with overridden subprograms. The completion is done on site. > At the very least the interfaces must match. > > But the parent type's "plan" might require that the type's operations > be called in a certain order, sayoperation A > is called before operation D, no matter what comes in between. This is poor design. Abstract types were introduced in first place in order not to have such uncheckable low-level contracts. One of the ideas of OO decomposition was to introduce objects maintaining their state in order to simplify interfaces. > How do you talk about this on site? Can you trust the plug-in code? > Suppose you don't use Ada, but Python or some other more dynamically > typed language. Can you even assume the type has the same interface > as its parent? When the absence of a statically known interface > destroys all hope for type safety, how can programmers sill trust > Google to continue providing meaningful Python objects for Google > App Engine? This is an unrelated issue. If you have contracts to be checked dynamically, you need a meta framework where contracts were types, statically known. Something must be static. > 2 - The utility function of a business might include a variable > that stands for cost of conflict. Cost of conflict is in part > negotiated, in part a consequence of the legal system. > > The conflict here is triggered by a malfunctioning program: > who/what is to blame when a type extension (by party X) does not > work nicely with a partial program (by party Y)? Any software/hardware decomposition has this problem. The solution is specifications/contracts. More detailed they are less space is left for conflicts. > Demonstrable correctness and type safety can be turned into > arguments. "Clearly, our partial program is correct, and type > safe. Therefore, your type extension makes the product > malfunction." -- "But we only varied the order of calls and > your type specifies nothing in this area. Why didn't you > specify ordering requirements as preconditions?" ... The program semantics cannot be specified exhaustively. I don't know were you want to go, but it is not only impossible to specify all program semantics, moreover, it is also impossible to have LSP subtyping. Substitutability in the context of subtyping cannot be upheld statically. You have to verify substitutability per each case of substitution. Since we trust you, we do not verify it. Is it what you consider as "trustworthiness"? Non-contracted behavior? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de