On 02/11/2021 01:38, Bart wrote:
> Sorry, but I had a lot of trouble understanding your A68 example. For
> example, part of it involved arrays, which I thought was some extra
> ability you'd thrown in, but I think now may actually be necessary to
> implement that feature. [I still don't know...]
??? Arrays in Algol are sufficiently similar to those in
other languages [even C!] that I don't see why you would think them
some "extra ability". If you meant the cast [again, similar to C],
then that was [in the specific example] necessary because the
construct "(a, b, c)" is not unambiguously an array of integers
[it could have been (eg) a structure of three integer variables],
and so needs a stronger context to disambiguate. No cast is needed
in cases where the operand is already an array of integers.
[...]
>> For example, if you happen to be doing matrix algebra,
>> it is likely to be much clearer if you write new operators rather
>> than new functions, so that you can reproduce quite closely normal
>> mathematical notations.
> It could well be clearer, AFTER you've had to implement it via code
> that is a lot less clearer than ordinary user-code.
The implementation in Algol is exactly the same, apart
from writing
OP + = # ... whatever ... #; ...
instead of
PROC matrixadd = # ... whatever ... #; ...
Everything you need to look at and understand in the one case is
the same in the other case.
> (My first scripting language had application-specific types including
> 3D transformation matrices and 3D points. There, if A and B are
> matrices, and P is a point, then:
> C := A*B # multiples matrices
> Q := C*P # use C to transform P
> /That/ was clear, with the bonus that the user didn't need to
> implement a big chunk of the language themself!)
Every language has to decide which facilities should be
provided as a standard library [or equivalent], and which left
to either purveyors of application-specific libraries or ordinary
users. Algol took the view, very reasonably, that it was not the
job of the language itself to specify matrix packages, statistics
packages, windowing systems, tensor calculus, cryptography, or a
host of other things that informed users can write themselves.
Same applies to Pascal, C and other languages both early and late.
It is of course open to you to advertise your version of [whatever
language] to include packages for this/that/the_other; but you
can't plausibly expect language designers to be expert not only
in specifying syntax and semantics but also in advanced algebra,
statistics, numerical analysis, combinatorial game theory, theory
of relativity, astrophysics, genetics, .... Indeed, you can even
less expect that today than you could 50-odd years ago when it
was normal for computer people to have backgrounds in maths,
physics and/or engineering.
>> Code will only be "mixed" if several
>> people write different bits of a project /without/ agreeing the
>> specifications of their own bits; that is a problem for /any/
>> large project, and nothing to do with Algol. You can write code
>> that is difficult to "read, understand, modify or port" in any
>> non-trivial language; again, nothing special about Algol, more to
>> do with unskilled programmers following dubious practices.
> If the effect is to create lots of mini, overlapping dialects or
> extensions, then that is a problem. There will be assorted custom
> preludes or drag in too.
That too is nothing at all to do specifically with Algol
[or Fortran or C or Pascal or ...]. It's a "problem" for any
general purpose language. It's not an unmitigated good for a
language to supply lots of facilities "as of right"; it makes
manuals and specifications much more complicated, and it means
that every implementer has to be able to write stats functions,
symbolic algebra packages, sound editors, ..., whatever it is
you decide is important enough to be an integral part of the
language. What you do in your own private language is, of
course, entirely up to you, and you will presumably provide
those and only those things that you both want and know about.
The rest of the world has different wants and knowledge.
>>> [...] I do not support chained comparisons.
>>> However, they are in the standard library.
>> If you don't "support" them then what do you mean by "in the
>> standard library"?
> They are implemented as user-functions which are placed in a library
> that comes with the language.
So they are supported! Or, if I find a bug are you
going to say "Oh, that's only part of the standard library,
nothing to do with me, guv', complain to [who?]"?
[...]>> You can't fix "break" or "a*b"; by the time of 7th Edition,
>> it was already too late,
> It's never too late. An alternate to 'break' could have been
> introduced for switch, eg. have both 'break' and 'breaksw';
> eventually only 'breaksw' is allowed, and 'break' is an error. Then,
> further along, 'break' inside switch is allowed to be used for
> loop-break.
That takes three revision cycles, for something that is
only a minor irritant, not a pressing need. C moves v slowly.
> However, try taking a program from 1980 and try compiling it now.
I can do slightly better than that. I have C programs
from the late '70s, [therefore] all in K&R C, one of them still
in regular use. I've actually made almost no use ever of C
facilities other than K&R, and have written very little C since
the early '90s [Algol is so-o-o much more productive!]. But my
old programs still work [or still have the same bugs, sadly!].
> Actually, take a program from 2021 and try building it with two
> different compilers.
Give me a second Algol compiler [or a different "sh"!]
and I'll try the experiment.
[...]
>> Allowing "a=b=c=d" shows that "a=b" means one thing if it
>> is "stand alone" and something quite different if it is a left
>> operand. You're very good at saying "my language allows XXX" for
>> all manner of interesting and perhaps even desirable "XXX", but
>> it's at the expense of specifying exactly what the related syntax
>> and semantics are.
> I copied the feature from Python. You'd need to ask Guido what it
> means!
I thought it was your language we were talking about. How
can I, or anyone else, judge your language against C or Algol or
any other language if /you/ can't tell us what its syntax and
semantics are?
>> In Algol, expressions are parsed by the usual
>> rules of precedence and [L->R] associativity, after which "a o b"
>> for any operands "a" and "b" and any operator "o" means exactly
>> the same as "f(a,b)" where "f" is a function with two parameters
>> of the same types as those of "o" and the same code body as that
>> of "o", all completely visible in the RR plus your own code.
>> What's the corresponding rule in your language?
> If I write:
> A = B = C
> in static code, then it works something like this:
> * The dominant type of A, B, C is determined
> * A, B, C are converted to that type as needed, as values A', B', C'
> (This is for numeric types; "=" also works for exactly compatible
> arbitrary types with no conversions applied)
> * The expression returns True when A', B', C' have identical values
OK, so we now know what "A = B = C" means. Are there
different rules for every operator, for every number of operands,
for every type, ..., amounting to perhaps hundreds of pages, or
is there [as in Algol] a general rule that can explain the syntax
in a couple of paragraphs and the semantics in another few? It
affects how hard your language is to explain to potential users,
or to people here trying to understand your arguments.
Composer of the day:
www.cuboid.me.uk/andy/Music/Composers/Bizet