Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result parameter for Create, Append, Open, Close #5

Open
zertovitch opened this issue Nov 27, 2020 · 1 comment
Open

Result parameter for Create, Append, Open, Close #5

zertovitch opened this issue Nov 27, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@zertovitch
Copy link
Owner

Since exception handling is not yet supported, we'd like a mean to handle cases where the file operations Create, Append, Open, Close fail. An idea is to have variants with a Result parameter. These variants can be useful too when exception handling is implemented, by the way.
Example for Create:

  --  If the operation fails, one of the Name_Error, Use_Error, Status_Error exceptions is raised.

  procedure Create (File : in out File_Type; Name : String);
  procedure Create (File : in out File_Type; Name : VString);

  --  Variants of Create, Append, Open, Close with a "Result" parameter.
  --  If the operation fails, Result is set to the value corresponding to the exception.

  type File_Operation_Result is (Success, Erroneous_Name, Erroneous_Use, Erroneous_Status);

  procedure Create (File : in out File_Type; Name : String; Result: out File_Operation_Result);
  procedure Create (File : in out File_Type; Name : VString; Result: out File_Operation_Result); 

@zertovitch zertovitch added the enhancement New feature or request label Nov 27, 2020
@zertovitch
Copy link
Owner Author

Meditating on this, I think it's a wrong way that will complicate things in the end. Better implement exception handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant