Hi Damian --
I will look at it over the next week. I can see where you are coming from
but, Hmmm. Need to think.
To be clear, I'm not saying what we have is right, and when it was first
pointed out to me, I had the same surprise you did. But I also haven't
figured out a way to make your interpretation work without having the
slice be something other than an array (that's what the issue explores).
I was going to suggest that a multidimensional array might be more
appropriate for the kind of case you were writing, but then I saw your
second thread touched on multidimensional arrays and haven't had the
chance to digest that yet (it being the weekend and all).
Even now, a Chapel n-dimensional array is a 2nd class object because you
cannot assign literals to it in a declaration.
Yeah, this is a known lack. There's no deep reason for the lack of a
multidimensional array initializer other than that we were slow to support
array literals at all, and didn't invent a syntax for the multidimensional
case when we did add them. There was a discussion about this some time
ago on chapel-developers:
https://sourceforge.net/p/chapel/mailman/message/31974940/
and I think we just need to find someone to motivate us to implement it.
This could be you -- feel free to open a GitHub issue requesting it. (And
frankly, for things that are more naturally multidimensional arrays... as
I believe your example seems to be... this will result in nicer
capabilities I believe. Also, implementing multidimensional array
literals will probably be far simpler than unraveling the "slicing arrays
of arrays" case.
I use an array of an array for a matrix to let me initialize it. But I
have just seen that this now has other implications.
Maybe the trick is just to initialize the multidimensional case in another
way for now? (assign it within a loop or read it in from a file?) But
again, we could fill this gap if it would help you.
-Brad
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers