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

Are we committed to supporting the separate assignment of the real/imaginary components of a complex? #18217

Closed
bradcray opened this issue Aug 12, 2021 · 4 comments

Comments

@bradcray
Copy link
Member

bradcray commented Aug 12, 2021

In a meeting today, we were discussing how most Chapel types are "singletons" that can't be partially modified, but have to be modified via re-assignment: integers, ranges, dense rectangular domains, strings, bytes. It was asserted that complexes had this property as well, and a few of us confirmed that that was our understanding / recollection, but checking, it seems we were wrong about that. For example, you can write:

var c: complex;
c.re = 1.0;

which makes complexes somewhat of an outlier compared to other built-in types (but if viewed as being similar to a record or tuple, perhaps doesn't make it an outlier at all).

This issue asks whether we're sure that this is what we want given that some of us had it wrong.

@bradcray
Copy link
Member Author

Tagging @npadmana on this issue as one of our biggest users of complex values to see how he feels about this (my guess: wouldn't want it to change).

Tagging @gbtitus , @e-kayrakli , @mstrout as people who I recall as speaking up during this part of the discussion.

@damianmoz
Copy link

How is works currently is perfectly fine with me. Certainly this is how I use it in my code and have for as long as I can remember. You would break my code and numerous algorithms is you did not allow it, or at least provide a method to update the real or imaginary field on its own. I do not consider it an outlier. It seems perfectly natural.

@npadmana
Copy link
Contributor

Agreed. I would also prefer to keep the ability to separately assign the real and imaginary parts.

@bradcray
Copy link
Member Author

OK, thanks. I'm going to close this then, as I don't think there's any real argument for changing the behavior; I just wanted to note it because a few people asserted that it couldn't be changed piece-wise, and I wanted to make sure we hadn't enabled it without consideration.

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

3 participants