Random impressions as I read van Vliet ever more closely
Jose E. Marchesi
jemarch@gnu.org
Tue Jun 2 22:23:35 GMT 2026
Hi Chris.
> Greetings everyone,
>
> Now with both van Vliet's code (and not-code) in one hand and his book in
> the other, I am starting to really notice some interesting things...
>
> One thing that kind of surprises me is his open(ref file file, string idf,
> channel chan) int - it returns zero when the open "succeeds" and non-zero
> otherwise, which sounds good at first look, but then I notice that:
>
> 1. it only fails and returns a non-zero value when the attempt to find a
> system file that matches idf fails
> 2. if the caller opens a file for reading that is not readable, it DOES
> NOT fail; similarly, if a file is opened for writing that is not writable,
> it DOES NOT fail.
>
> Taking this a bit further, if I attempt to open a file for reading that is
> not readable and open returns a zero value, I then have to query
> get_possible on that file. Similarly for put_possible, bin_possible,
> compressible, reset_possible, set_possible, reidf_possible.
Ok...
> van Vliet also provides for backspace_possible.
>
> I'm not confident that I can (for example) open a system file for reading
> that is not readable and then leave it open, which is the behaviour
> indicated by van Vliet (and I guess the RR), later permitting it to be
> closed. It seems to me that the POSIX open routine will fail in this
> situation and the Algol 68 file should therefore not be considered open.
>
> Am I missing something here? Thanks for any and all pointers
> provided...
I would say, opening a File doesn't necessarily means to open an
underlying POSIX file descriptor, nor any other possible underlying Book
in other devices such as a socket or whatever.
Opening a File over a channel that implies a POSIX file may just make
sure that a POSIX file with idf path exists, and check its permissions
to set the possibles etc.
Alternativly, you may open the POSIX file with whatever permissions it
allows, after using stat to fill in the possibles, and keep it open.
More information about the Algol68
mailing list