should the default be lower bounds or upper bounds? Peter McGoron (11 Apr 2026 13:42 UTC)
Re: should the default be lower bounds or upper bounds? John Cowan (11 Apr 2026 23:06 UTC)
Re: should the default be lower bounds or upper bounds? Peter McGoron (12 Apr 2026 00:40 UTC)
Re: should the default be lower bounds or upper bounds? Per Bothner (12 Apr 2026 03:01 UTC)
Re: should the default be lower bounds or upper bounds? John Cowan (12 Apr 2026 04:38 UTC)
Re: should the default be lower bounds or upper bounds? John Cowan (12 Apr 2026 01:55 UTC)
Re: should the default be lower bounds or upper bounds? Peter McGoron (12 Apr 2026 03:22 UTC)
Re: should the default be lower bounds or upper bounds? Bradley J Lucier (12 Apr 2026 04:08 UTC)
Re: should the default be lower bounds or upper bounds? John Cowan (12 Apr 2026 04:50 UTC)
Re: should the default be lower bounds or upper bounds? Bradley Lucier (12 Apr 2026 16:00 UTC)
Re: should the default be lower bounds or upper bounds? Peter McGoron (12 Apr 2026 16:14 UTC)

Re: should the default be lower bounds or upper bounds? John Cowan 11 Apr 2026 23:05 UTC

On Sat, Apr 11, 2026 at 9:42 AM Peter McGoron <xxxxxx@mcgoron.com> wrote:

> Would it be better to have the single integer be the lower bound, and
> have the upper bound be determined by the length of the array?

I think that would be quite surprising. I did a little cross-language
investigation, and few languages support lower bounds at all despite
their obvious utility: Fortran, PL/I, ANSI Full Basic, and Algol 60
and 68.  In the Algols, the lower bound is always required: otherwise
a single bound is taken to be the upper bound.  (Many Basics only
allow the lower bound of all dimensions of all arrays to be set
globally with the "Option Base 0|1" statement.)

> It would
> be easier to modify the array without having to count the number of
> elements in each dimension

That's true, and it was one of the reasons why I originally went with
just having lower bounds.  But I think their ergonomics are terrible.
You should be able to determine the shape of an array without looking
at the data in it.

> I can do so without modifying the type of the array. I would find this
> more useful, personally, and if I wanted the reader to check my numbers

> 1. This sentence:
>
>     > The number of dimensions is inferred from the length of bounds it
> would be impossible
>
>     sounds like it should have something between "bounds" and "it":

Yes, I missed the semicolon.

> 2. This part of the grammar:
>
>         bound := integer | "(" integer* ")
>
>     should be
>
>         bound := integer | "(" integer integer ")

Another brain fart.

> 3. The "integer" production should be modified to include prefixed
> integers, like #xFF.

I don't think this is an essential feature.  When would you naturally
specify dimensions in strange bases?

> 4. I would add an examples of 3D and 4D arrays, because those are going
> to be less intuitive.

Fair enough.