Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-03 Thread Frank Peelo
Rainer Stratmann wrote: Am Saturday 02 January 2010 16:34:57 schrieb JoshyFun: a: array[1..] or string = ('aaa', 'bbb', 'ccc'); That would be perfect. Then you can automatically calculate the amount: amax = sizeof( a ) div sizeof( a[ 1 ] ); If this syntax was in Pascal, would you use

Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-03 Thread Jonas Maebe
On 03 Jan 2010, at 13:03, Frank Peelo wrote: Rainer Stratmann wrote: Am Saturday 02 January 2010 16:34:57 schrieb JoshyFun: a: array[1..] or string = ('aaa', 'bbb', 'ccc'); That would be perfect. Then you can automatically calculate the amount: amax = sizeof( a ) div sizeof( a[ 1 ] );

Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-03 Thread Rainer Stratmann
Am Sunday 03 January 2010 13:03:37 schrieb Frank Peelo: Rainer Stratmann wrote: Am Saturday 02 January 2010 16:34:57 schrieb JoshyFun: a: array[1..] or string = ('aaa', 'bbb', 'ccc'); That would be perfect. Then you can automatically calculate the amount: amax = sizeof( a ) div

Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-03 Thread Jonas Maebe
On 03 Jan 2010, at 13:12, Rainer Stratmann wrote: Am Sunday 03 January 2010 13:03:37 schrieb Frank Peelo: Rainer Stratmann wrote: Then you can automatically calculate the amount: amax = sizeof( a ) div sizeof( a[ 1 ] ); If this syntax was in Pascal, would you use High(a)-Low(a)+1 rather

Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-03 Thread Rainer Stratmann
Am Sunday 03 January 2010 13:19:39 schrieb Jonas Maebe: On 03 Jan 2010, at 13:12, Rainer Stratmann wrote: Am Sunday 03 January 2010 13:03:37 schrieb Frank Peelo: Rainer Stratmann wrote: Then you can automatically calculate the amount: amax = sizeof( a ) div sizeof( a[ 1 ] ); If this

Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-03 Thread Jürgen Hestermann
Rainer Stratmann schrieb: Pascal has better ways to deal with array bounds. But at this moment it is not possible to make a const array with auto calculated range ( [ 1..] ). It would be easy to implement, I think. But these things are not related. Calculating array bounds should not be

[fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-02 Thread Juha Manninen
On torstai, 31. joulukuuta 2009 16:33:50 Anthony Walter wrote: No, the compiler will not fill in the array length based on your element list. It does compute the length while compiling and *you* need to match it in your declaration. In most cases it would be better if the compiler counted the

Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-02 Thread JoshyFun
Hello FPC-Pascal, Saturday, January 2, 2010, 4:01:35 PM, you wrote: JM In most cases it would be better if the compiler counted the number of JM elements. Only in few cases the programmer really wants to limit the number to JM some predefined value. JM The currently used syntax for const array

Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-02 Thread Jürgen Hestermann
Juha Manninen schrieb: const a: array of string = ('aaa', 'bbb', 'ccc'); It looks like a dynamic array, but obviously is not dynamic because it is constant. :-) The indexing would start from 0 like with dynamic arrays. It would not break the existing syntax and would be very intuitive.

Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-02 Thread Juha Manninen
On lauantai, 2. tammikuuta 2010 17:34:57 JoshyFun wrote: From my point of view that's a dynamic array, if it looks like a dynamic array ir should be a dynamic array. It can't be dynamic because it is under const section :-) Other pascals uses something like: a: array[1..] or string = ('aaa',

Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-02 Thread Rainer Stratmann
Am Saturday 02 January 2010 16:34:57 schrieb JoshyFun: a: array[1..] or string = ('aaa', 'bbb', 'ccc'); That would be perfect. Then you can automatically calculate the amount: amax = sizeof( a ) div sizeof( a[ 1 ] ); And you are free to set the number of the first array, in this case 1. Like

Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-02 Thread Vincent Snijders
Jürgen Hestermann schreef: Juha Manninen schrieb: const a: array of string = ('aaa', 'bbb', 'ccc'); It looks like a dynamic array, but obviously is not dynamic because it is constant. :-) The indexing would start from 0 like with dynamic arrays. It would not break the existing syntax and