From Newsgroup: comp.lang.misc
On 2026-01-05 00:57, Andy Walker wrote:
On 04/01/2026 00:42, Janis Papanagnou wrote:
[...] I don't see
anything that forbids that interaction from including an exit code.
I seem to recall to have read it somewhere (forgot where) and stumbled
across it again in the previously quoted Lindsey paper (see APPENDIX 6.
"Syntax Charts", pp. 353f) in a more formalized way. It first explains:
-a-a"Above some of the rectangles there appears an indication of the
-a-a mode that the construct inside is expected to yield, [...]"
where for the "Particular Program" the Enclosed Clause is marked as
"strong void" in the respective syntax chart.
So, as to my suggestion, to formulate something like
-a-a BEGIN
-a-a-a-a INT rc = 1;
-a-a-a-a rc
-a-a END
would (as to my understanding) not be allowed in the outmost enclosed
clause.
-a (a) It is allowed!-a The context requires a "strong void" and you have supplied an "INT";-a this can be "strong"ly coerced by the "void"ing
coercion to mode "void", as required,-a Indeed, as any mode can be
strongly voided to void, you can supply anything as the result of your outermost enclosed clause.
Thanks for the clarification.
What I meant is the _consequence_ of this special syntactical case;
while it may be syntactically allowed, if it gets voided then it's
effectively also not returning a status value; which was my concern.
As it's defined the implicit voiding couldn't be prevented by writing
an exit code value. So with this existing definition it's impossible
to return anything. If we'd write in any particular program a value
as return of the outmost block we'd have the effect guaranteed (per
language specification) that nothing will be returned. The language
doesn't seem to allow returning a value because it's prevented by
that definition. (But maybe I still misunderstood what you said.)
-a (b) You have been describing a "particular program";-a this is what you, as a programmer, write.-a But the system us concerned with "program texts", which include also the relevant libraries, preludes and postludes and in which your "particular program" is embedded.-a It's the "program text" that has to deliver [by means unspecified in the RR] any interaction with the
OS [as well as (eg) library routines such as "sqrt"].
Okay.
-a (c) You probably /don't/ want your program simply to return the status, even in an extended A68 or A68G,
???
If you want an exit status you could write a value. If you don't
want (and not write) an exit status value you could just omit it.
The calling context (the "prelude"? - not sure) could hide the
details how a value ('void', 'int' in the allowed range, or else)
would be passed to the environment.
For example; a void outer block result could be translated to an
implicit default 0 return status ('okay' status)
BEGIN ...; print (newline) END
while
BEGIN INT rc; ...; rc END
would return the value according to the OS interface rules. And
things like
BEGIN NOT_INT_MODE a; ...; a := b END
or an INT value outside OS scope could be defined with whatever
seems appropriate; depending on case, say, a voided interpretation,
a warning or error, a masking of an INT value, whatever. But that
all is as it appears to me not covered by the now general mandated
implicit voiding.
Firstly, because most current programs
terminate with some result that is not any sort of status [not even zero],
so they will all need to be re-written,
Depending on how the outer language context is defined - see above -
I don't think this is a necessary consequence.
Secondly, because "interesting"
status results come from /not/ simply running off the end of the program
[eg interrupts, wrong permissions, non-existent files, ...] which, by default, is likely to cause your program to abort with an error.
In a language that doesn't support "C"-like exit() to leave from
everywhere you could employ other mechanics. Many other languages
do that with exception mechanisms. An Algol 68 implementation could
do that with an event routine (or just with a jump, as shown in so
many examples).
So a
perhaps better mechanism would be to add a library routine which can set
the status and can be used by either the programmer or A68G.
Yes, this is a possible alternative approach. - It has advantages,
and it wouldn't conflict with the mentioned semantic constraints.
Janis
--- Synchronet 3.21a-Linux NewsLink 1.2