Regarding literals and loop indices modes / programming friction

jpl jpl.algol68@gmail.com
Sun Jan 25 10:11:39 GMT 2026


Greetings All,

I have added some local operators for complex arithmetic to allow
proceeding with FFT work.  It has been much fun and educational, and
also brings some questions regarding modes for literals and loop
indices:

1. Are literals unable to be automatically coerced to the target of
the initialization?

   For example:

   int i:=1;  (works as expected)

   long int il:= 1;      (fails with error: 'int' cannot be coerced to
'long int'))
   long int il:= Leng 1  (using Leng works fine)

2. Must we manually use "Leng" on a counter when operating on long real?

   long real zl;

   for count to 3 do
      zl +:= Leng count
   od;

If so, this creates a large amount of "friction" when changing (for
example) loops of a DFT calculation.  Is it possible to decrease the
amount of friction?

Example when using mode "compl":

   for i from Lwb x to Upb x do
     for j from Lwb x to Upb x do
         w := (cos(-(i*j)*2*pi/n) , sin(-(i*j)*2*pi/n));
         y[i] := y[i] + w * x[j]
      od
   od;

Example when using mode "long compl":

   for i from Lwb x to Upb x do
     for j from Lwb x to Upb x do

         w := (long_cos(-(Leng i * Leng j) * Leng 2 * long_pi / Leng(n) ) ,
               long_sin(-(Leng i * Leng j) * Leng 2 * long_pi / Leng(n) ));

         y[i] := y[i] + w * x[j]
      od
   od;

This question has relations to earlier discussion on this list
regarding procedure overloading and generics.  But, keeping this post
simple for now.

Cheers, James


More information about the Algol68 mailing list