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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fd63afa4dc364b7e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-02 04:30:04 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!isdnet!newscore.gigabell.net!fu-berlin.de!uni-berlin.de!ailinel.cbb-automation.DE!not-for-mail From: dmitry@elros.cbb-automation.de (Dmitry Kazakov) Newsgroups: comp.lang.ada Subject: Re: Static typing (Was Re: Better support for garbage collection) Date: Mon, 02 Apr 2001 11:29:36 GMT Message-ID: <3ac85c82.13458000@news.cis.dfn.de> References: NNTP-Posting-Host: ailinel.cbb-automation.de (212.79.194.99) X-Trace: fu-berlin.de 986210976 4280296 212.79.194.99 (16 [77047]) X-Newsreader: Forte Free Agent 1.21/32.243 Xref: supernews.google.com comp.lang.ada:6328 Date: 2001-04-02T11:29:36+00:00 List-Id: On Fri, 30 Mar 2001 12:44:57 -0800, "Robert C. Leif, Ph.D." wrote: >From: Bob Leif >To: Dmitry Kazakov et al. >Are you proposing that Universal_Integer, Universal_Float, >Universal_Character, etc. become visible types that can be explicitly used >in type conversions including where an object of a type like integer can be >converted to being of type Universal_Integer. Would it include subprograms >like: >function "+" (Left : Integer'Base; Right : Universal_Integer) return >Integer'Base; > >This would be very useful, since it would facilitate the use of private >numeric types. I have yet to be able to cleanly use a private type >Data_16_Type and directly add a literal to it. >I would like: >function To_Data_16_Type(The_Universal_Integer: Universal_Integer) return >Data_16_Type; > >In essence these Universal_Types could now be used to explicitly specify the >classes of integers, floats, and characters. I can see the danger of >permitting programming with weakened types. However, these types could be >included in a separate package Standard.Universal and be subject to the >Pragma Restrictions or equivalent. Yes and no. In my opinion instances of universal types may not exist at run time. A universal_integer has an arbitrary length, its actual representation is upon the compiler. So one may not have an object of this type. In the end an instance of a universal type should be always converted to some "legal" type. Yet with user-defined conversions one will have an ability to explicitly add literals to a private type: function (Value : Integer) return Data_16_Type; Then the following conversion path is applied: 123 (of universal_integer)->123 (of Integer)-> 123 (of Data_16_Type) Further this issue is obviuosly relevant to another thread (where the compile time routines are discussed). If such beasts were allowed then one might have exactly what you mentioned: function (Value : Universal_Integer) return Data_16_Type; ??pragma ;?? As for danger, it is immense, yet in modern times (take a look at comp.object) strong-static-manifested typing is considered as an evil?! (:-() Regards, Dmitry Kazakov