Products > Programming

old book with examples in PL/I: will a C-guy understand them?

<< < (29/29)

MarkMLl:

--- Quote from: guenthert on January 13, 2022, 04:25:15 pm ---But back to the original question:  will PL/I make sense to a programmer (most) familiar with C?
PL/I is a bit of an oddball in that it supports recoverable exceptions (I only know of Common Lisp which offers the same) for which some support of dynamic scoping (like old LISPs) is needed.  That'll be quite alien to a C programmer.

--- End quote ---

As does Object Pascal, any language which supports an eval() e.g. Perl, and for that matter I know of an ALGOL-60 implementation which goes some way towards having them.

MarkMLl

brucehoult:

--- Quote from: MarkMLl on January 14, 2022, 08:32:53 am ---
--- Quote from: guenthert on January 13, 2022, 04:25:15 pm ---But back to the original question:  will PL/I make sense to a programmer (most) familiar with C?
PL/I is a bit of an oddball in that it supports recoverable exceptions (I only know of Common Lisp which offers the same) for which some support of dynamic scoping (like old LISPs) is needed.  That'll be quite alien to a C programmer.

--- End quote ---

As does Object Pascal, any language which supports an eval() e.g. Perl, and for that matter I know of an ALGOL-60 implementation which goes some way towards having them.

--- End quote ---

I ... don't think you're understanding the concept.

The idea is something similar to how a Page Fault is handled. The program tries to access a page that is not in memory at the moment -- maybe doesn't even exist anywhere right now. You don't abort the program. Instead you allocate a new memory page and zero it, or load the existing one from disk into RAM. Then you resume the program at the same instruction that had the problem. The program never knows anything happened (unless it compares a high resolution timer just before and after)

Recoverable exceptions is extending that (hardware assisted) idea to exceptions thrown in a program. For example your program might be writing to a disk file when the disk fills up. An exception is thrown. The handler sees that there is a bunch of stuff in /tmp and deletes it (or compresses some log files or something). The handler returns to the point of the throw and the write to the file succeeds, without the user's program being aware that anything ever happened, or having to be coded specially in any way.

MarkMLl:

--- Quote from: brucehoult on January 14, 2022, 08:53:56 am ---I ... don't think you're understanding the concept.

Recoverable exceptions is extending that (hardware assisted) idea to exceptions thrown in a program. For example your program might be writing to a disk file when the disk fills up. An exception is thrown. The handler sees that there is a bunch of stuff in /tmp and deletes it (or compresses some log files or something). The handler returns to the point of the throw and the write to the file succeeds, without the user's program being aware that anything ever happened, or having to be coded specially in any way.

--- End quote ---

I understand the concept perfectly well. In what way does OP not do what you're describing?

MarkMLl

MarkMLl:

--- Quote from: DiTBho on January 13, 2022, 02:31:11 pm ---*The* algorithm was invented by Edsger Dijkstra and named the "shunting yard" algorithm because its operation resembles that of a railroad shunting yard.

--- End quote ---

Or more to the point Grau and Waychoff. Waychoff is rarely credited since his corporate situation prevented publication, but as far as I know it was he who first used ALGOL to implement ALGOL in such a way that recursive functions in the compiler mirrored recursive definitions in the language.

MarkMLl

brucehoult:

--- Quote from: MarkMLl on January 14, 2022, 09:24:52 am ---
--- Quote from: brucehoult on January 14, 2022, 08:53:56 am ---I ... don't think you're understanding the concept.

Recoverable exceptions is extending that (hardware assisted) idea to exceptions thrown in a program. For example your program might be writing to a disk file when the disk fills up. An exception is thrown. The handler sees that there is a bunch of stuff in /tmp and deletes it (or compresses some log files or something). The handler returns to the point of the throw and the write to the file succeeds, without the user's program being aware that anything ever happened, or having to be coded specially in any way.

--- End quote ---

I understand the concept perfectly well. In what way does OP not do what you're describing?

--- End quote ---

The facilities in Object Pascal, languages which support eval() such a Perl (Python, Javascript), and others such as C++, Java, C# ABSOLUTELY DO NOT do or support what I am describing.

Common Lisp and Dylan do.

Navigation

[0] Message Index

[*] Previous page

There was an error while thanking
Thanking...
Go to full version