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: a07f3367d7,39579ad87542da0e X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.66.191.130 with SMTP id gy2mr4961013pac.19.1368583773359; Tue, 14 May 2013 19:09:33 -0700 (PDT) Path: bp1ni2329pbd.1!nntp.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!nrc-news.nrc.ca!News.Dal.Ca!citadel.nobulus.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Seeking for papers about tagged types vs access to subprograms Date: Sat, 11 May 2013 08:37:15 +0200 Organization: cbb software GmbH Message-ID: <1q2ql1e4rcgko.diszzq1mhaq8$.dlg@40tude.net> References: <17ceq51ydy3s0.s94miqqzbg5w.dlg@40tude.net> <1vrhb7oc4qbob$.q02vuouyovp5$.dlg@40tude.net> <19lrzzbgm77v6.1dzpgqckptaj6.dlg@40tude.net> <1bfhq7jo34xpi.p8n2vq6yjsea.dlg@40tude.net> <12gn9wvv1gwfk.10ikfju4rzmnj.dlg@40tude.net> <1oy5rmprgawqs.1jz36okze0xju$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: 15waz9CoS+eMakbyhTPyFQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Received-Bytes: 6104 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2013-05-11T08:37:15+02:00 List-Id: On Fri, 10 May 2013 19:42:37 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:1oy5rmprgawqs.1jz36okze0xju$.dlg@40tude.net... >> On Thu, 9 May 2013 17:19:14 -0500, Randy Brukardt wrote: >> >>> "Dmitry A. Kazakov" wrote in message >>> news:12gn9wvv1gwfk.10ikfju4rzmnj.dlg@40tude.net... >>>> On Wed, 8 May 2013 15:27:50 -0500, Randy Brukardt wrote: >>>> >>>>> "Dmitry A. Kazakov" wrote in message >>>>> news:nd22gfeezrwf$.tlj4yyygrwq3$.dlg@40tude.net... >>>>> ... >>>>>> Each time you do something with a type you get another one. Otherwise >>>>>> it becomes untyped. >>>>> >>>>> That way leads to madness, I think. It's better for "types" to be >>>>> fairly weak and interoperable. >>>> >>>> Weak typing is better? >>> >>> Yes, because we need to move beyond typing to other forms of static error >>> detection. >> >> Based on what? On individual values? > > What I was calling profiles; Nicolas has provided a reference that says its > known as "typestate" analysis. It sits on top of types providing more > information for static checking. That applies to stateful types only. Not every type is stateful. Bringing state into objects is considered bad practice. So bad, that it motivated some people to invent whole programming paradigms to avoid stateful object, e.g. functional programming. The sole idea of FP is to sweep states under the carpet. Stateful OOA/D vs. stateless FP are both extremes, but in any case one should not base the language design (!) on exposing states. State machines existed since the beginning of computing. As a compiler designer you should know better how difficult, almost impossibly, it is to use state machine patterns. >>> I want checking that is *stronger* than what can be provided by statically >>> applied types. Trying to get it by extending the type model directly is >>> madness, especially as it makes sharing much less possible. >> >> No, you will lose a whole universe of checks without gaining anything >> useful. Checks of individual values have limits imposed by computability. >> Furthermore, focusing on values, you will kill software engineering. Reuse >> is what is really important. Checks are only a tool to make reuse safer. > > I'm adding on top of types, not in place of them. On top of something which formalization of you call madness? >>>> Strong typing is an ability to distinguish types. Not mixing types means >>>> that you could not have subprograms with more than one argument. It is >>>> just crazy. >>> >>> Certainly when you invent ideas like this, which have nothing to do with >>> anything that I said or was thinking about. Obviously, operations of one >>> type need parameters of another type. But your OOP-fever means that you >>> think that this somehow implies the types are related. >> >> What else a relationship is? Types deal with values and operations. There >> is nothing else. Since values are not shared (Ada is typed so far), the >> only thing which may bind two types is a shared operation. > > I don't think operations have anything to do with types: they *use* types, > they aren't part of them in any way. The "profile" of objects determines > what operations can be used with them. Dynamically? Because if statically, then that is exactly what is called a type. When dynamically, why bother yourself inventing another SmallTalk? It is already there. > Keep in mind that what I've trying to do here is to get the sort of > statically checked preconditions that you keep saying are necessary. First of all, there are preconditions of operations and the precondition put on individual calls. I don't know which one you mean here. But the preconditions of operations must be statically true. Meaning: a declared operation can be called anywhere. The client may annotate his calls to the operation with additional preconditions related to the logic of the program that uses the operation. These are not the property of the operation and unrelated to the type. The idea that the precondition of first kind should depend on the state of the objects involved in the operation is a very, VERY bad idea. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de