On Tue, 4 Aug 2015, Michael Ferguson wrote:

> Section 19.8.1 says you can use assignment to resize a domain.
> For example,
> D = { 1..10 }

Saw stuff like this long ago.

My eyes finally hit this.

        If the domain variable being assigned was used to declare arrays,
        these arrays are reallocated as discussed in 20.11.

I have never noticed the word 'reallocated'.

And the important explanatory information is actually in 20.11.

> In addition, we recently implemented operations similar to C++
> vectors for 1-D arrays with non-shared domains. Examples of
> that are here:
>
> {test/release/}examples/primers/arrayVectorOps.chpl

I will read.

>> On Mon, 3 Aug 2015, Michael Ferguson wrote:
>>
>>> What would be most useful about this bit of history is if we knew
>>> *why* flexible array bounds were regarded as a no-no by many
>>> people.
>>
>> I was simply reminding people to look. I have never used the concept in
>> Algol68 although I use it ever so occassionally in C/C++.
>
> I had a look at "A History of ALGOL 68" by Lindsey, which only reports
> that appending to a flexible array was commonly desired but not
> implemented in the standard library. It didn't say that flexible
> arrays were "considered harmful" or anything like that.

Sorry, I gave the wrong impression. There were big overheads in some 
implementations, although I only ever tried three of them. Also, I think 
some people mentioned that the way it was done was driven by the needs of 
string handling, rather than a more optimal method. As I said, long time 
ago.

And then I discovered C++ in the 1980s and my brain thought it could 
forget all other languages.

> Flexible arrays in Algol are marked as such - so a Chapel analogue
> would be if we had something like
>
> var A:[flex 1..10] int;
>
> which would mean that A could be resized. But all Chapel arrays
> can already be resized

That is NOT obvious to somebody only using some of the language features. 
And I have been looking at Chapel for a few years now. Then again, I do 
not program by reallocating so maybe I was never trying to do resizing. I 
tend to compute storage needs outside of a a set of routines or a whole 
program and then make an allocation immediate on jumping into a new 
routine. Old habits die hard.

I assume that Chapel arrays come off the heap in a single threaded
program.

> - it's just that for a long time we had the rule that you had to
>   separately declare the domain in order to do the resizing, like this:
>
> var D:domain(1) = {1..10};
> var A:[D] int;
>
> D = {1..100}; // resizes A

I understand this now from reading 20.11.

I will revisit your original ideas about reading.

Regards - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer

------------------------------------------------------------------------------
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to