Take the following example:
type MyArray is array(1..10) of Float;
type MyRecord is record
a: Float;
b: Integer;
c: Boolean;
d: MyArray;
end record;
…
function foo(x: MyRecord) return MyRecord is
y: MyRecord := x;
begin
y.b = -1;
return y.b;
end foo;
It would be nice if I could do something like this instead with foo
:
function foo(x: MyRecord) return MyRecord is
(x with (b => -1));
Where the simpler notation (which is not valid Ada) allows me to write foo
as an expression function. Is there a way to do something like this in Ada?