The Algol 68 language has the interesting property that basically
every "block" has a value that is passed to the outer block level.
This is actually perfect if we consider the outmost (top-level)
block as the place where its value could be passed as exit-code
to the environment.
But (if I'm not mistaken) that seems to be explicitly forbidden
by the language!
I think it would be a sensible "extension" to remove that special
case and allow returning an exit status; for Algol 68 it's too
late but in Genie it might be useful.
On 01/01/2026 12:31, Janis Papanagnou wrote:
[...]
The Algol 68 language has the interesting property that basically
every "block" has a value that is passed to the outer block level.
This is actually perfect if we consider the outmost (top-level)
block as the place where its value could be passed as exit-code
to the environment.
But (if I'm not mistaken) that seems to be explicitly forbidden
by the language!
-a-a-a-aI think that's an exaggeration.-a The RR essentially describes
your program as being "embedded" in a collection of preludes/postludes
that define the standard environment and also in some way [not defined
by the RR] the interaction of your program with the OS.-a I don't see anything that forbids that interaction from including an exit code.
[...]
I think it would be a sensible "extension" to remove that special
case and allow returning an exit status; for Algol 68 it's too
late but in Genie it might be useful.
-a-a-a-aI wouldn't have any objection to some sucn extension, but I
also wouldn't have any great use for it.-a YMMV.
[...] I don't seeI seem to recall to have read it somewhere (forgot where) and stumbled
anything that forbids that interaction from including an exit code.
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"Above some of the rectangles there appears an indication of the
-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 BEGIN
-a-a-a INT rc = 1;
-a-a-a rc
-a END
would (as to my understanding) not be allowed in the outmost enclosed
clause.
-a-a-a-a-aI wouldn't have any objection to some such extension, but IThat's the standard way of passing status between different interacting programs in process-oriented (scripted) systems. (I use this standard mechanism with every language I program in.)
also wouldn't have any great use for it.-a YMMV.
(c) You probably /don't/ want your program simply to return the
status, even in an extended A68 or A68G, 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,
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. 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.
On 04/01/2026 00:42, Janis Papanagnou wrote:
[...] I don't seeI seem to recall to have read it somewhere (forgot where) and stumbled
anything that forbids that interaction from including an exit code.
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.
-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"].
-a (c) You probably /don't/ want your program simply to return the status, even in an extended A68 or A68G,
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,
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.
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.
On Sun, 4 Jan 2026 23:57:43 +0000, Andy Walker wrote:
(c) You probably /don't/ want your program simply to return the
status, even in an extended A68 or A68G, 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,
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. 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.
Even if you werenrCOt concerned with backward compatibility, I still wouldnrCOt want to do it C-style, where rCLmainrCY is a procedure which is given the command-line strings as arguments and is expected to return
the exit status. Much better to access these via library routines (or implicit globals). Makes it easier to write separate argument-parsing
code, that kind of thing.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 54 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 12:29:20 |
| Calls: | 742 |
| Files: | 1,218 |
| D/L today: |
2 files (2,024K bytes) |
| Messages: | 183,176 |
| Posted today: | 1 |