Skip to content

Functions cannot yet return a record #24

Description

@johnperry-math

To the code:

package Test_Function is

type R is record
   a: Integer;
end record;

function F return R;

end Test_Function;

...HAC replies:

test_function.ads: 7:20-20: this type is not supported for a function's result; try a procedure with an "out" parameter
Errors found, build failed.

Could this not be supported by the compiler's silently doing precisely this for the user? i.e., isn't every function, in some sense, syntactic sugar for a procedure with an out parameter?

(There may be additional restrictions on a function; e.g., immutability of parameters and global data, but I would imagine that this can likewise be enforced by the compiler while still supporting the change above.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions