Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Roadworks

7 views
Skip to first unread message

Claudio Calvelli

unread,
Jun 7, 2023, 6:07:16 PM6/7/23
to
It'll be safe to say this here because nobody reads it any more...

I've just had a thought for a new feature which seems absolutely
essential, and in fact will be included in CLC-INTERCAL before it's
allowed to escape again.

Diversions. Also known as Roadworks.

Example syntax:

DO CLOSE OFF (label1) TO (label2) AND DIVERT VIA (label3) TO (label4)
[WHILE NOT CLOSING IT OFF]

(or maybe "WHILE NOT TAKING THE DIVERSION")

Meaning, the obvious: the portion of program which sits (logically)
between (label1) and (label2), extremes included, will be closed off and
any attempt to reach (label1) in the normal flow of execution will jump
to (label3) instead. Unlike a "COME FROM (label1)", the statement at
(label1) won't be executed. As the program is now inside the diversion,
there will be a temporary "COME FROM (label4)" added to the statement
after the one at (label2), so that the program can return from the
diversion.

Here's an example:

DO CLOSE OFF (1) TO (2) AND DIVERT VIA (3) TO (4)
DO WRITE IN .1
(1) PLEASE READ OUT .1
DO GIVE UP
(2) DO .2 <- .1 ~ #1
DO READ OUT .2
DO GIVE UP
(3) DO .2 <- #42
(4) DO READ OUT .2

The order of execution will be:

DO CLOSE OFF (1) TO (2) AND DIVERT VIA (3) TO (4)
DO WRITE IN .1
(3) DO .2 <- #42
(4) DO READ OUT .2
DO READ OUT .2
DO GIVE UP

because the three statements:

(1) PLEASE READ OUT .1
DO GIVE UP
(2) DO .2 <- .1 ~ #1

are closed off and the diversion is via:

(3) DO .2 <- #42
(4) DO READ OUT .2

Of course, there would also be a statement to remove the diversion:

DO REOPEN (label1) TO (label2) [WHILE KEEPING IT CLOSED OFF]

C

Claudio Calvelli

unread,
Jun 30, 2023, 8:13:57 AM6/30/23
to
On 2023-06-07, Claudio Calvelli <c.n...@w42.org.invalid> wrote:
> Example syntax:
>
> DO CLOSE OFF (label1) TO (label2) AND DIVERT VIA (label3) TO (label4)
> [WHILE NOT CLOSING IT OFF]

OK, that's implemented with slightly different syntax:

DO CLOSE OFF BETWEEN (label1) AND (label2)
AND DIVERT VIA (label3) TO (label4)
[WHILE LEAVING IT OPEN]

This is essentially a generalisation of ABSTAIN FROM applied to a whole
block of statements at once, combined with a COME FROM to insert some
new code where the program would have been executing the closed-off
section.

Therefore there is a need to extend REINSTATE the same way, and I've
implemented:

PLEASE REOPEN BETWEEN (label1) AND (label2)
[WHILE LEAVING IT CLOSED]

Now, on to my next item in the "TO DO" list, making registers a bit less
boring. I mean, any programming language can have variables which you
can assign a value to, and then when you go looking later they still
have the same value. How boring is that? Even things like volatile
variables suffer from the same problem: either another thread assigns to
them, or maybe they are connected to a bit of hardware, or in any case
there is always something assigning to them.

There must be a way for CLC-INTERCAL to make registers more interesting,
and I am working on an idea (this is a general health warning).

C

0 new messages