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

General subscripting #3395

Merged
merged 9 commits into from Sep 28, 2023
Merged

Conversation

HansOlsson
Copy link
Collaborator

Add general subscripting also to Modelica.
Closes #2659

As noted in that ticket the previously discussed blocking cases are basically irrelevant.
An alternative to stating that all operations generate arrays indexed by 1...n is to state that general subscripting transforms the arrays to such a form - the downside is that (a)[1] isn't the same as a[1] - the upside is that (a)[1] is valid regardless of how the array is subscripted.
The end effect should be similar.

@olivleno
Copy link
Collaborator

Thanks @HansOlsson for your proposal to resolve this issue.
@sjoelund @henrikt-ma @gkurzbach I'd like to encourage you to comment and review.

chapters/arrays.tex Outdated Show resolved Hide resolved
chapters/arrays.tex Outdated Show resolved Hide resolved
chapters/syntax.tex Outdated Show resolved Hide resolved
Copy link
Collaborator

@henrikt-ma henrikt-ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main concern is the characterization of how a matrix-valued expression should be indexed.

HansOlsson and others added 4 commits July 31, 2023 11:27
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
@HansOlsson HansOlsson added this to the Phone 2023-4 milestone Aug 24, 2023
@HansOlsson
Copy link
Collaborator Author

Phone meeting:
Should clean up types of array expressions - indexing should match the type.
Hans: As long as there is only indexing with integers it is safe to subscript with integers.
(and delay the rest).

Shouldn't close before we have new issue for type of array expressions, but it can be closed later.

@HansOlsson
Copy link
Collaborator Author

Added #3410 - note that it is even more restrictive than I thought.

@HansOlsson
Copy link
Collaborator Author

Looking more closely at the text I see that we already have very drastic restrictions on non-Integer subscripts. So, the text that looks like a new restriction here was in fact implicitly present (if the operations generated anything else it could barely be used) - I still think it good to have as a normative text, instead of changing it to non-normative.

The new issue is also opened.

chapters/arrays.tex Outdated Show resolved Hide resolved
Copy link
Collaborator

@henrikt-ma henrikt-ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting that we avoid making statements that are dependent on the resolution of #3410.

chapters/arrays.tex Outdated Show resolved Hide resolved
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
@HansOlsson
Copy link
Collaborator Author

Requesting that we avoid making statements that are dependent on the resolution of #3410.

Should be resolved

Copy link
Collaborator

@henrikt-ma henrikt-ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Assuming that the example listing has been verified to fit the page width.

@HansOlsson HansOlsson merged commit 619aaeb into modelica:master Sep 28, 2023
1 check passed
@HansOlsson HansOlsson deleted the GeneralSubscripting branch September 28, 2023 15:05
@HansOlsson HansOlsson added the M37 For pull requests merged into Modelica 3.7 label Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M37 For pull requests merged into Modelica 3.7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subscripting of general expressions
3 participants