❌ About FreshRSS

Normal view

There are new articles available, click to refresh the page.
Today β€” 28 September 2023News from the Ada programming language world

Initializing a discriminated record

By: cantanima
28 September 2023 at 06:06

(If it matters, alr tells me that this is gnat_external=12.3.1; notice the pragma)

I was recently in a situation along these lines:

pragma Ada_2022;

   --  ...

   type Enum is (A, B, C);

   type Disc_Rec (Kind : Enum) is record
      case Kind is
         when A => Field : Natural;
         when others => null;
      end case;
   end record;

   --  ... in what follows, `Thing` is of type `constant Enum` and `Value` is of type 

         D : Disc_Rec := (
            case Thing is
               when A => Disc_Rec'(Kind => A, Field => Value),
               when B | C => Disc_Rec'(Kind => Thing)               --  LINE 37
         );

gnat tells me:

test_enum.adb:37:48: error: no single variant is associated with all values of the subtype of discriminant value "Kind"

Column 47 lands on Thing.

I understand the message, but I’d have thought it clear that since Thing has the type B or C in line 37, Thing has all values of the subtype that matter in this branch. Indeed, if Disc_Rec does not have the case statement that defines Field, and I remove the assignment to Field in line 36, the compiler sings happily. So the problem doesn’t seem to be Thing so much as that the optional Field… which isn’t needed in this branch.

Is there a way to make something like this work? My current workaround handles the branches explicitly (when A => ... , when B => ..., when C => ...), but In a practical case, Kind could have a lot of variants.

3 posts - 3 participants

Read full topic

Yesterday β€” 27 September 2023News from the Ada programming language world

Initialise type from address

I want to initialise a type from a System.address. For example :

generic
    type T_Generic is private;
package MyPackage is
    G_Addr : System.Address;
    procedure Register (myAddr : System.address);
    procedure MyProcedure (myAddr : System.address);
end MyPackage;

package body MyPackage is
    procedure Register(myAddr : System.address)
    is
        G_Addr := myAddr;
    end MyProcedure;

    procedure MyProcedure (myAddr : System.address)
        myVar : T_Generic with address => myAddr;
    is
        if (myAddr = G_Addr)
        then
            -- work with myVar 
        end if;
    end MyProcedure;
end MyPackage;
    

But I cannot compile this piece of code myVar : T_Generic with address => myAddr; :

aspect specification is an Ada 2012 feature

unit must be compiled with -gnat2012 switch

I cannot change compilation's options, how can I do ?

Before yesterdayNews from the Ada programming language world

AEiC 2024 - Ada-Europe conference - 1st Call for Contributions

26 September 2023 at 12:30

The 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024) will take place in Barcelona, Spain in the week of 11-14 June.

The conference schedule comprises a journal track, an industrial track, a work-in-progress track, a vendor exhibition, parallel tutorials, and satellite workshops.

Deadlines: 15 January 2024 for journal-track papers; 26 February 2024 for industrial-track and work-in-progress-track papers, tutorial and workshop proposals.

More information is available on the conference site, including an extensive list of topics; details on the call for contributions for the various tracks will follow shortly.

www.ada-europe.org/conference2024

#AEiC2024 #AdaEurope #AdaProgramming

1 post - 1 participant

Read full topic

AEiC 2024 - Ada-Europe conference - 1st Call for Contributions

The 28th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2024) will take place in Barcelona, Spain in the week of 11-14 June.

The conference schedule comprises a journal track, an industrial track, a work-in-progress track, a vendor exhibition, parallel tutorials, and satellite workshops.

Deadlines: 15 January 2024 for journal-track papers; 26 February 2024 for industrial-track and work-in-progress-track papers, tutorial and workshop proposals.

More information is available on the conference site, including an extensive list of topics; details on the call for contributions for the various tracks will follow shortly.

www.ada-europe.org/conference2024

#AEiC2024 #AdaEurope #AdaProgramming

submitted by /u/Dirk042
[link] [comments]

US Government is requesting information on adoption of memory safe programming languages

By: AJ-Ianozi
24 September 2023 at 22:02

Like the title says, the US Government is requesting information on adoption of memory safe programming languages and open-source software security.

They’re currently taking comments until October 9th. I think this is a good opportunity to help bring Ada back into the spotlight.

https://www.federalregister.gov/documents/2023/08/10/2023-17239/request-for-information-on-open-source-software-security-areas-of-long-term-focus-and-prioritization

1 post - 1 participant

Read full topic

❌
❌