Peter N Lewis wrote:
I thought GPC handled array splices, but this:
program peter109;
type MyArray(count: Integer) = array[1..count] of Integer; var p: ^MyArray; begin New(p,10); p^[1..5] := p^[2..6]; end.
Gives a compiler error:
peter109.pas:9: error: type mismatch in array assignment
It works for strings, but I guess strings have all that packed array of char type checking extra baggage.
Yes. More precisely, EP defines slices only for strings. Other array slices are a GPC extension, so these rules are actually nowhere defined, so in principle we could change them. I agree that what you want to do would be nice to have.
However, this might be difficult to implement, because which type should an array slice have? For string slices, we have the generic string-type which is always compatible. For other arrays, there are no generic types, and two arrays [1 .. 5] and [2 .. 6] are normally not compatible. I suppose the Borland solution would be to shift slices (if they had them) to base 0, as they do with arrays in several other contexts, but I don't really like this (as it can be very confusing and a trap to the unknowing, as are their "open arrays"). So if we can find a more elegant solution, without doing away with type-checking at all, of course, it could be worth changing it in GPC ...
While I'm at it, is there any better way to zero part of such an array than:
FillChar( p^[3], 4 * SizeOf(p^[3]), 0 );
I suppose a simple for-loop is not acceptable for some reason?
And further while I'm at it, I looked at the docs for MoveLeft et al, and they are all under construction. Would it be worth while setting up a wiki for the docs?
I doubt it. You know, we've had so many efforts to plan and organize writing, improving, translating documentation etc. It always went like this: Longish, often heated debates, finally someone (often me) setting something up, one or two people writing one or two paragraphs, and then everyone forgetting about it.
I think the problem is really whether there's people willing to write something. If they write something substantial, I'd even be willing to include it in the manual manually (but I think the last time this happened was some 4 years ago) ...
The docs already have an organizational layout, which is very helpful for starting a wiki and letting others add information. I've never set up a wiki before, but I'd be happy to set it up and look at transferring the existing documentation over if people thought it was a good idea.
I won't stop you if you like. (Only I won't do any serious setup effort anymore ...)
I know the docs are all tied in with the make system, and there might be some loss with regard to automation of that,
In the end the results should be transferred back to Texinfo format, so we can produce the different output formats. (It's not so much about the make system, but just so we can generate different formats such as Info, HTML or PDF.) So you might want to plan for this in your setup. E.g., if you do it for the reference chapter, the most lacking bit, you might want to predetermine the structure (Synopsis, Description, ...), and your wiki software should allow for automated extraction as formatted text. Converting the formatting then should be a simple matter of scripting ...
Frank