Sometimes one wishes to address the elements of an array as if they belonged to a different structure. For instance, use a piece of a 1D array as if it were a 3D array. This can be done with pointers, but pointers bring about their own problems (e.g. they require a target). At least in the most simple cases (contiguous elements), one would think associate could do the job, but as far as I can see, associate does not support reshaping or remapping arrays. So, my suggestion is to allow this.
A possible use case (syntax mockup):
associate(matrix(0:N,0:N) => array(ip:ip+(N+1)**2) ! or (why not), just => array(ip:) ?
matrix(:,:) = 0.0
do i=0,N
matrix(i,i) = real(i)**2
end do
end associate
Sometimes one wishes to address the elements of an array as if they belonged to a different structure. For instance, use a piece of a 1D array as if it were a 3D array. This can be done with pointers, but pointers bring about their own problems (e.g. they require a
target
). At least in the most simple cases (contiguous elements), one would thinkassociate
could do the job, but as far as I can see,associate
does not support reshaping or remapping arrays. So, my suggestion is to allow this.A possible use case (syntax mockup):