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

Allow constructors in instance creation expressions to not have to return the new object #38

Closed
seidewitz opened this issue Mar 14, 2017 · 1 comment
Assignees
Milestone

Comments

@seidewitz
Copy link
Contributor

In UML, a constructor operation is supposed to return the newly constructed object, and this is presumed in the current mapping for instance creation expressions using a constructor operation. When a constructor is mapped from Alf, the return parameter is added automatically and the returning of the object is handled in the constructor body mapping. However, when a constructor is added to a class using a graphical UML tool, it is awkward to have to include an explicit return parameter, and it doesn't add any value to do so, anyway. Further, the expectation from constructors in programming languages is that they do not have an explicit return value, so it is often left out in the model, too -- which would cause an error with the current mapping if such a constructor so modeled was used in an Alf instance creation expression.

Since the value returned from the constructor should always be the newly constructed object anyway, it would be better if the mapping for the instance creation expression used the result of the create object action as the result value for the expression and simply ignored the value returned from the constructor (if any). In this way, it would not be necessary to require that a constructor from an external model be have a return value (but it would still work if the constructor had one, as long as the returned value was the constructed object, as expected).

@seidewitz
Copy link
Contributor Author

Resolved in v1.0.5a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant