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=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,73cb216d191f0fef X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII X-Received: by 10.180.89.133 with SMTP id bo5mr5298650wib.6.1363185313859; Wed, 13 Mar 2013 07:35:13 -0700 (PDT) Path: bp2ni89854wib.1!nntp.google.com!proxad.net!feeder1-2.proxad.net!weretis.net!feeder1.news.weretis.net!news.albasani.net!news.teledata-fn.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 13 Mar 2013 15:34:41 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Is this expected behavior or not References: <8klywqh2pf$.1f949flc1xeia.dlg@40tude.net> <513f6e2f$0$6572$9b4e6d93@newsspool3.arcor-online.net> <513faaf7$0$6626$9b4e6d93@newsspool2.arcor-online.net> In-Reply-To: X-Enigmail-Version: 1.5.1 Message-ID: <51408e81$0$6577$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 13 Mar 2013 15:34:41 CET NNTP-Posting-Host: b328d51e.newsspool3.arcor-online.net X-Trace: DXC=;QIaff^TI:M@k=MdN::NBIMcF=Q^Z^V3H4Fo<]lROoRA8kF_ljHiLnc\616M64>JLh>_cHTX3jMDbWPENeCP[D X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: 2013-03-13T15:34:41+01:00 List-Id: On 13.03.13 14:31, Dmitry A. Kazakov wrote: > On Wed, 13 Mar 2013 10:45:54 +0100, J-P. Rosen wrote: > >> Le 13/03/2013 09:49, Dmitry A. Kazakov a �crit : >>> In Ada subtype >>> (here subtype is Ada-subtype) operations are inherited per composition with >>> conversion to the base type which is null for in-arguments and sometimes >>> range-check of outs (not always, though). E.g. >>> >>> F (X : S) = F (S'Base (X)) >>> >>> S is a subtype *because* it inherits F. >> >> Not at all. In Ada, a type is a set of values. > > A type is a set of values bound by operations defined on them. It is > values+operations. The LRM does not define what it means for sets of values being "bound by operations". It does define subtypes and types. > Even under your (wrong) definition Positive is still different from Integer > because Positive does not have values like -1. I don't think this is true. In Ada, Positive and Integer are not different types. The names Positive and Integer refer to the same type; objects happen to be associated with different range constraints. See Ivan Godard's comment on his invention, the subtype in Ada: http://newsgroups.derkeiler.com/Archive/Comp/comp.arch/2012-08/msg00360.html > Ada subtypes are proper types External observations inspired by whichever type theory do not apply when judging things from the Ada perspective. I'd find observations interesting only when someone is pondering language design, not when explaining properties of an existing language. Randy mentioned a time machine... > E.g. these two programs are not equivalent: > > X : Integer := -1; ... > You cannot replace Integer with Positive without changing the semantics of > any possible program, hence they are different. The difference only means that different range constraints yield different programs. Nothing about different Ada types here. X : Integer := -2; yields another semantically different program. Does the difference (assigning -2, not -1) tell anything about the Ada type of X? Constraint_Error on assigning a negative value to a variable whose range constraint requires positive values is a consequence of range checking *in* the same type's set.