Groups | Search | Server Info | Login | Register


Groups > comp.lang.misc > #11609

Re: Algol 68 - array of procedures aligned at index 0 ?

From bart <bc@freeuk.com>
Newsgroups comp.lang.misc
Subject Re: Algol 68 - array of procedures aligned at index 0 ?
Date 2025-11-10 17:05 +0000
Organization A noiseless patient Spider
Message-ID <10et605$55dd$1@dont-email.me> (permalink)
References (11 earlier) <10ennas$2l8i0$1@dont-email.me> <10erajk$36lno$1@dont-email.me> <10esgnk$3u6qk$2@dont-email.me> <10esulh$3sd55$1@dont-email.me> <10et1o5$3cseb$1@paganini.bofh.team>

Show all headers | View raw


On 10/11/2025 15:52, Waldek Hebisch wrote:
> Andy Walker <anw@cuboid.co.uk> wrote:
>> On 10/11/2025 11:02, bart wrote:
>>> But if "()" worked, and was unambiguous, and is not particularly harder
>>> to use or uglier (eg. compared witn trigraphs), then why bother with "[]"> at all?
>>
>>         Most of us find "[]" more attractive than "()" for arrays when
>> available.  Algol [not just 68] has always had aesthetics as a [minor]
>> objective;  and was always intended as a "publication" language -- "I've
>> had this spiffing idea, look ..." to be typeset in CompJ, CACM, etc.
> 
> First languages that I learned (Fortran and Basic) used '()'.  Sligtly
> later I was introduced to '[]' and got used to it.  But looking at
> modern usage I think that using _the same_ way both for functions and
> for arrays is better.  So basically '()' is better, unless your
> language uses '[]' for function calls.  Why?  Logicaly functions
> and arrays have very similar role: given argument they produce
> corresponding value.  Of course, normal arrays are limited to
> integer indices and range of index must be connected (no gaps are
> allowed). 

Function and arrays are somewhat different:

* A function specifies some arbitrary piece of /code/ that is invoked on 
the args you provide.

* An array is some object: it is /data/. You don't invoke it; there will 
be some implicit code that effectively takes both array and index as 
arguments, and returns some value

* A function call can have side-effects, or it might not return any 
value, or a return value is ignored.

* Arrays can also be l-values:

    A[i] := x

This is far less common with functions. There are other differences, for 
example, functions may have large numbers of args, they may be default 
values, they can use keyword parameters, they might use uniform call 
syntax (x.f(y) instead f(x, y); it would be odd to do i.a[j].

You can argue that in both cases, you provide 2 or more operands and get 
some result. In that case you might as well use () for everything:

   if(cond, a, b)
   +(x, y)

But it is convenient and useful to have dedicated syntax.

> But that is merely condition for efficient implementation.
> There are sparse arrays and associative arrays which do not share
> this limitation (but access take more time).

There is another aspect which is to do with dynamic (usually intepreted) 
code.

Using A[] and F(), you can generate dedicated bytecode instructions for 
each. You may still need to do runtime checks, but it can still be more 
efficient than only one generic instruction for X(), and now /having/ to 
dispatch on both X's type, and number of arguments.

With A[i,j], which is really A[i][j], you can generate two indexing ops, 
but with X(i,j), when X is an array, you now have to deal with both in 
the same bytecode handler.

Actually, I use A[] for normal indexing, and A{} for indexing hashtables 
by key. Both [] and {} accesses can be done on the same table.

Back to comp.lang.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-01 16:00 +0100
  Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-01 20:54 +0000
    Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-02 07:33 +0100
      Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-02 09:50 +0100
      Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-02 11:10 +0000
        Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-02 11:44 +0000
          Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-02 13:12 +0100
            Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-02 13:23 +0100
          Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-03 00:42 +0000
            Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-03 15:03 +0000
              Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-03 16:40 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-03 17:00 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-03 21:02 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-03 20:34 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-03 22:35 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-03 23:37 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-04 07:16 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-04 11:10 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? David Brown <david.brown@hesbynett.no> - 2025-11-04 16:46 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-04 16:17 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-04 17:26 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? David Brown <david.brown@hesbynett.no> - 2025-11-04 17:49 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-04 18:38 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-04 19:30 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? David Brown <david.brown@hesbynett.no> - 2025-11-04 21:04 +0100
                Homebrew languages (was: Algol 68 - array of procedures aligned at index 0 ?) bart <bc@freeuk.com> - 2025-11-06 00:39 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-05 12:52 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-05 14:02 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-04 18:28 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? David Brown <david.brown@hesbynett.no> - 2025-11-04 21:14 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-03 17:32 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-03 20:28 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-03 20:10 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-03 22:31 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-04 12:24 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? David Brown <david.brown@hesbynett.no> - 2025-11-04 17:02 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-05 12:25 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-05 14:12 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-05 14:28 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-06 08:29 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-06 14:18 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-06 15:58 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-07 21:22 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-07 23:13 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-08 03:17 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? antispam@fricas.org (Waldek Hebisch) - 2025-11-08 03:50 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-08 04:47 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-08 12:42 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-08 21:37 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-09 20:34 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-09 21:08 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? antispam@fricas.org (Waldek Hebisch) - 2025-11-09 16:58 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-08 11:34 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? antispam@fricas.org (Waldek Hebisch) - 2025-11-09 17:16 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-09 19:11 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-09 20:58 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? antispam@fricas.org (Waldek Hebisch) - 2025-11-10 13:56 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-10 20:52 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? antispam@fricas.org (Waldek Hebisch) - 2025-11-11 12:53 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-11 20:51 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? David Brown <david.brown@hesbynett.no> - 2025-11-06 17:14 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-06 19:41 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-06 22:01 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-08 12:24 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-07 23:33 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-04 00:35 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-04 07:07 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-04 14:57 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-05 23:59 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-06 01:03 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-06 07:40 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-06 10:59 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-06 16:59 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-06 17:58 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-06 20:14 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-06 22:16 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-06 22:47 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-07 14:34 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-07 15:42 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-07 16:50 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-07 19:49 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-07 20:01 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-08 00:26 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-08 01:54 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-08 14:00 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-08 15:24 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-10 00:11 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-10 00:43 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? David Brown <david.brown@hesbynett.no> - 2025-11-10 09:08 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? antispam@fricas.org (Waldek Hebisch) - 2025-11-10 13:28 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? ram@zedat.fu-berlin.de (Stefan Ram) - 2025-11-10 10:11 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-10 11:02 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-10 15:00 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? antispam@fricas.org (Waldek Hebisch) - 2025-11-10 15:52 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-10 17:05 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-10 10:10 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? Andy Walker <anw@cuboid.co.uk> - 2025-11-10 15:48 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-07 17:59 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-07 18:39 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-12 11:01 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-12 20:47 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-12 22:22 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-12 23:28 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-13 01:31 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-11-13 09:35 +0100
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-13 11:37 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-04 01:05 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? bart <bc@freeuk.com> - 2025-11-04 01:24 +0000
                Re: Algol 68 - array of procedures aligned at index 0 ? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-04 02:28 +0000

csiph-web