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

Array module review followup: Throw an exception if you try and do a "Chapel Style" print out of a multidimensional array. #18090

Closed
stonea opened this issue Jul 21, 2021 · 2 comments

Comments

@stonea
Copy link
Contributor

stonea commented Jul 21, 2021

This is a followup item for the Array module review.

Since we haven't yet determined what the syntax for initializing multi-dimensional arrays should be, we wanted to ensure that if you try and print out a multidimensional array in "Chapel style" we get some kind of error
message.

@mppf
Copy link
Member

mppf commented Jul 22, 2021

Here is an example of the current behavior:

var A:[1..2, 1..2] string = "hi";

writef("%ht\n", A);
[
 ["hi", "hi"],
 ["hi", "hi"]
]

@e-kayrakli
Copy link
Contributor

Current behavior seems wrong, and I am for preventing Chapel style IO for multidimensional arrays until we have a better strategy for it.

@stonea stonea changed the title Array module review followup: Investigate if we throw an exception if you try and do a "Chapel Style" print out of a multidimensional array. Array module review followup: Throw an exception if you try and do a "Chapel Style" print out of a multidimensional array. Aug 24, 2021
stonea added a commit that referenced this issue Sep 1, 2021
…ultidim_array_print

Array module review --- error on multidim array print

This PR satisfies this issue: #18090 (Array module review followup: Investigate if we throw an exception if you try and do a "Chapel Style" print out of a multidimensional array)

Basically, we decided that since Chapel doesn't have a syntax for defining a multi-dimensional array literal we want to error out if you try and do a "Chapel style" print 

In other words the following should error:

```Chpl
var A:[1..2, 1..2] string = "hi";
writef("%ht\n", A);
```
And with this PR, it now will with the following message:
```
uncaught IllegalArgumentError: Can not perform Chapel write of multidimensional array.
  foo.chpl:2: thrown here
  foo.chpl:2: uncaught here
```

[Reviewed by @bradcray and @dlongnecke-cray]
@stonea stonea closed this as completed Sep 1, 2021
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

4 participants