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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!fx11.iad.POSTED!not-for-mail From: Shark8 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:32.0) Gecko/20100101 Thunderbird/32.0a1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada's ranking of popularity at IEEE Spectrum References: <72b1318a-2eb6-4129-af9b-5bcfbb329c5b@googlegroups.com> <3dcb7839-3003-4fcd-afb6-3369f715102b@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@teranews.com NNTP-Posting-Date: Wed, 09 Jul 2014 02:30:54 UTC Organization: TeraNews.com Date: Tue, 08 Jul 2014 20:30:55 -0600 X-Received-Bytes: 4526 X-Received-Body-CRC: 4052241785 Xref: news.eternal-september.org comp.lang.ada:20821 Date: 2014-07-08T20:30:55-06:00 List-Id: On 08-Jul-14 17:03, sbelmont700@gmail.com wrote: > So we, as a community, cannot easily divide up the work in a component like manner, > and are usually forced to start all way down at the O/S interface level *for every > single project*. Why would we need to start at the OS level for TLS? Yes, I realize we'll need to depend on X.509 and ASN.1, but I don't see why we cannot write [at least those] in a generally platform-independent manner. In fact, given Ada's reputation as being highly-portable, wouldn't writing theses basic [fundamental, not simple] components be a /good/ thing? > And again, even if you do manage to create an elegant Ada interface to OpenSSL, > it's not going to be OpenSSL, because OpenSSL is an untyped C API that is anathema > to everything Ada. The better you make it, the further away from the standard you > get, and the less people are going to want to use it. I said TLS, not OpenSSL. But even so, what's stopping someone from taking a formally-verified TLS component and wrapping/exporting it for C [and OpenSSL] compatibility? How would that be buying into C's type-system? e.g. what is stopping us from exporting to C-interface if we have a string-date package? Sure values and such won't be protected on the C-side, but we know about out Ada side, no? Package Date_String is -- Date-String format: ####-##-## Subtype Date_String is String(1..10) with Dynamic_Predicate => (for all Index in Date_String'Range => (case Index is when 5|8 => Date_String(Index) = '-', when others => Date_String(Index) in '0'..'9' ) ) and then -- short-circut boolean, ensures the above first (case Month(Date_String) is when 1 | 3 | 5 | 7 | 8 | 10 | 12 => Day(Date_String)'Valid, when 4 | 6 | 9 | 11 => Day(Date_String) in 1..30, when 2 => (if Is_Leap_Year(Date_String) then Day(Date_String) in 1..30 else Day(Date_String) in 1..29) ); SUBTYPE C_Date_String is Interfaces.C.Strings.char_array_access with Dynamic_Predicate => Interfaces.C.To_Ada(C_Date_String.All) in Date_String; -- Whatever procedures we need to export. Private Subtype Month_Type is Natural range 1..12; subtype Day_Type is Natural range 1..31; Function Year ( Input : String ) Return Natural is ( Natural'Value(Input(Input'First..Input'First+3)) ); Function Month( Input : String ) Return Month_Type is ( Natural'Value(Input(Input'First+5..Input'First+6)) ); Function Day ( Input : String ) Return Day_Type is ( Natural'Value(Input(Input'Last-1..Input'Last)) ); -- METHOD FOR DETERMINING LEAP-YEAR: -- (1) If the year is evenly divisible by 4, go to step 2. -- Otherwise, go to step 5. -- (2) If the year is evenly divisible by 100, go to step 3. -- Otherwise, go to step 4. -- (3) If the year is evenly divisible by 400, go to step 4. -- Otherwise, go to step 5. -- (4) The year is a leap year (it has 366 days). -- (5) The year is not a leap year (it has 365 days). -- -- CONCISELY: -- Year Mod 400 = 0 or (Year Mod 4 = 0 and Year Mod 100 /= 0) Function Is_Leap_Year( Year : Natural ) Return Boolean is (Year Mod 400 = 0 or (Year Mod 4 = 0 and Year Mod 100 /= 0)); Function Is_Leap_Year( Input : String ) Return Boolean is ( Is_Leap_Year(Year(Input)) ); End Date_String;