comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Question about asynchronous calls
Date: Wed, 6 Nov 2013 11:54:02 -0800 (PST)
Date: 2013-11-06T11:54:02-08:00	[thread overview]
Message-ID: <8a7f97ef-672e-4930-9502-e1202dd158fd@googlegroups.com> (raw)
In-Reply-To: <19b9cc6b-28a4-45e4-939c-7720ae5666b9@googlegroups.com>

On Wednesday, November 6, 2013 4:05:44 AM UTC-7, mockturtle wrote:
> Dear all,
> 
> I am scheduled to give an introductory talk (45 min) about Ada at the next "Open Source Day" here in Udine.  I was thinking about giving an overview of the language, emphasizing those parts that are unique (or almost unique) to Ada, with the objective of making people curious. 

While it doesn't seem like a big thing: subtypes.
It's nice not to have to check results of some-function from obviously-incorrect-but-technically-possible values like we have to in C/C++/PHP:

Ex: Some_Array'Length returns Natural, I don't have to check for -1 whenever I use it.

And that's from all the way back to Ada 83, with Ada 2012 we have subtype-predicates and can say the following:

    -- Refactor to a parent-type for SSN or EID.
    -- Note SSN is 11 characters long, EIN is 10.
    Type ID_String is new String
      with Dynamic_Predicate => ID_String'Length in 10|11;

    -- SSN format: ###-##-####
    Subtype Social_Security_Number is ID_String(1..11)
      with Dynamic_Predicate =>
	(for all Index in Social_Security_Number'Range =>
          (case Index is
           when 4|7 => Social_Security_Number(Index) = '-',
           when others => Social_Security_Number(Index) in '0'..'9'
          )
         );

    -- EIN format: ##-#######
    Subtype EIN is ID_String(1..10)
      with Dynamic_Predicate =>
	(for all Index in EIN'Range =>
          (case Index is
           when 3 => EIN(Index) = '-',
           when others => EIN(Index) in '0'..'9'
          )
         );

    -- A string guaranteed to be an SSN (###-##-####) or EIN (##-#######).
    Subtype Tax_ID is ID_String
      with Dynamic_Predicate =>
          (Tax_ID in Social_Security_Number) or
          (Tax_ID in EIN);

> Among other things, I am planning about saying something about the existence of Annex E for distributed systems.  
> 
> While reading section "E.4.1. Asynchronous Remote Calls" of our beloved RM, I got a doubt: as I understand the language does not define any specific mechanism for getting the "return value" of an asynchronous call; if I want the result back I must implement the "back channel" by myself (e.g., a callback or a polling function of type "are we there yet?" [to be said with childish voice] :-).  Am I right?

Sorry, I haven't used asynchronous-calls.


  parent reply	other threads:[~2013-11-06 19:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 11:05 Question about asynchronous calls mockturtle
2013-11-06 18:49 ` J-P. Rosen
2013-11-06 20:40   ` mockturtle
2013-11-06 19:54 ` Shark8 [this message]
2013-11-06 20:49   ` mockturtle
2013-11-07  7:46     ` Stefan.Lucks
2013-11-07 10:23       ` Predicates (was: Question about asynchronous calls) Georg Bauhaus
2013-11-07 18:59       ` Question about asynchronous calls mockturtle
2013-11-07  8:18     ` Jacob Sparre Andersen
2013-11-07 19:00       ` mockturtle
2013-11-06 20:49   ` Jeffrey Carter
2013-11-06 20:58     ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox