Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ada 202x A broad overview of relevant news

Florian Schanda

  • Login to see the comments

  • Be the first to like this

Ada 202x A broad overview of relevant news

  1. 1. Ada 202x A broad overview of relevant news 1st November, 2016 HIS 2016 Altran UK Limited Florian Schanda 1
  2. 2. Introduction Apologies Anish Mohammed (Ripple Labs) could sadly not attend - this is not his talk. Instead some news from the Ada language design group! Overall direction New language features Potential language features 2
  3. 3. Ada 202x Broad direction ’95 Polymorphism, Protected objects, and many more 2005 Interfaces, Ravenscar, Assertions, Containers 3
  4. 4. Ada 202x Broad direction ’95 Polymorphism, Protected objects, and many more 2005 Interfaces, Ravenscar, Assertions, Containers 2012 Contracts (and richer expressions) 3
  5. 5. Ada 202x Broad direction ’95 Polymorphism, Protected objects, and many more 2005 Interfaces, Ravenscar, Assertions, Containers 2012 Contracts (and richer expressions) 202x Parallelism (and richer expressions) 3
  6. 6. Ada 202x Parallelism Todays architectures are increasingly multi-core GPU based solutions are an extreme example It’s notoriously difficult to get this right 4
  7. 7. Ada 202x Parallelism Todays architectures are increasingly multi-core GPU based solutions are an extreme example It’s notoriously difficult to get this right Ada should make this easy! 4
  8. 8. Ada 202x Parallelism The parallel block statement: parallel P := Compute_Prime (Bits => 4096 , RNG => "/dev/random"); and Q := Compute_Prime (Bits => 4096 , RNG => "/dev/random"); end parallel; parallel N := P * Q; and Phi := (P - 1) * (Q - 1); end parallel; parallel Public_Key := Make_Public_Key (N, Phi ); and Private_Key := Make_Private_Key (N, Phi); end parallel; 5
  9. 9. Ada 202x Parallelism Something similar is planned for parallel loops. Three parts: Optional declaration of storage for each chunk Loop Optional reduction parallel Sum : array (<>) of Integer := (others => 0); −− Size of loop array depends on number of chunks for I in 1 .. 1_000_000 loop Sum (<>) := Sum (<>) + A (I); −− Write to the current chunk’s sum then Answer := 0; for Value of Sum loop Answer := Answer + Value; end loop; end loop; 6
  10. 10. Ada 202x Expressions Short-hand for the left-hand-side of an assignment: Database. Current_Instance (N). Usage_Count := @ + 1; 7
  11. 11. Ada 202x Expressions Short-hand for the left-hand-side of an assignment: Database. Current_Instance (N). Usage_Count := @ + 1; More flexible than += or similar short-hands found in other languages: Arr (X + Y) := (if @ < Integer ’Last then @ + 1 else Integer ’First ); 7
  12. 12. Ada 202x Expressions Delta aggregates replace Spark update expressions: procedure Adjust (R : in out Record_T; Fudge : Float) with Post => R = (R’Old with delta Low_Bound => Fudge * R’Old.Low_Bound , Hi_Bound => Fudge * R’Old.Hi_Bound ); −− We now know all other fields *do not* change Also quite useful in non-contract code: All_Zero : constant Array_T := (others => 0); Mask : constant Array_T := (All_Zero with delta A .. B => 1, C .. D => 1); 8
  13. 13. Ada 202x Tasking New aspect Nonblocking New aspect Max Entry Queue Length Extended Ravenscar profile Multiple entries Relative delay Support for Ada.Calendar and implicit heap allocations 9
  14. 14. Ada 202x Other possible features Let expressions Lambda functions 10
  15. 15. Ada 202x Other possible features Let expressions Lambda functions Generator subprograms (a limited form of co-routines) yield 0; −− Return to calling subprogram, resume execution here yield X; These are iterable: for Values of My_Generator loop −− First we get 0, then we get X, ... 10
  16. 16. Ada 202x Other possible features Let expressions Lambda functions Generator subprograms (a limited form of co-routines) yield 0; −− Return to calling subprogram, resume execution here yield X; These are iterable: for Values of My_Generator loop −− First we get 0, then we get X, ... Container aggregates and displays S : Hash_Set := (X, Y, Z); P : Hash_Set := (for N in Positive if Is_Prime (N) => N); 10
  17. 17. Ada 202x Conclusion Parallelism More expressions (better contracts) Many of these will make it into Spark 11
  18. 18. 12

×