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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,3ef3e78eacf6f938 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 Path: g2news2.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed2.ip.tiscali.net!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!de-l.enfer-du-nord.net!gegeweb.org!aioe.org!not-for-mail From: Cesar Rabak Newsgroups: comp.lang.eiffel,comp.lang.ada Subject: Re: Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3? Date: Mon, 20 Jul 2009 16:35:26 -0300 Organization: Aioe.org NNTP Server Message-ID: <4A64C6FE.3040003@yahoo.com.br> References: NNTP-Posting-Host: CypMocAmQgU7ZoH9HGMqRg.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org X-Antivirus-Status: Clean X-Notice: Filtered by postfilter v. 0.7.9 X-Antivirus: avast! (VPS 090513-0, 13/05/2009), Outbound message Cancel-Lock: sha1:Md+ehdujU5Fu+NfrB6zb92+qOJs= User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) Xref: g2news2.google.com comp.lang.eiffel:337 comp.lang.ada:7187 Date: 2009-07-20T16:35:26-03:00 List-Id: Hibou57 (Yannick Duch�ne) escreveu: > On 20 juil, 20:33, Cesar Rabak wrote: >> Here you create two "subtypes" which are only nicknames for Float in >> order to help the Ada compiler to discriminate the signature. BTW, why >> the need of two subtypes for coordinates? > Not � subtype � but � type �, which is not the same. Ada has both, and > both are differents. They are *considered* different in Ada technology, I respect that, but from a OO point of view, they are not: a new type would define a new set of operations on it. > > A type does not only designate a range of allowed values, it also > designate a source, which in turn, associate design property to it > (this can be asserted relying on type matching rules). In Ada language, defined as such. > > If you want to be sure what a function recieve only come from a > defined set of functions, then you define a type, some functions > returning value of this types, or procedure modifying this type. Two > types may seem similar at a quick sight, but types are not only used > to define ranges. Which is syntatic sugar for allowing signatures and allowing for internal consistency in the program *after* the variables have been initialized from a primitive type. > > Types allow to define the valid flow of some objects or values, it > allows to make assertions about where it come from and where it can go > (thus, what was done with on/with it). This as to deal with the > overall design, the whole usage of a library, and not only with the > set of value allowed for a given type. After have been initialized by primitive types (as your own example shows). > > This is not a kind of nickname, this is a difference written in the > stone From a practical matter it is only a nickname, see my example you snipped.