public modes - a question
chris hermansen
clhermansen@gmail.com
Sun Aug 23 19:42:23 GMT 2026
Good morning everyone,
I was reviewing the declaration for mode File today to see if any of
its fields are meant to be accessible outside the module. It seems
not, at least according to the RR p. 146 and van Vliet II p. 35.
I wonder if it would be possible to enforce this "opacity" using a
pragmat, something along the lines of
mode File = #[ opaque ]#
struct(ref Book book,
union(FlexText, Text) text,
Channel chan,
ref Format format,
ref int forp,
ref bool read_mood,
write_mood,
char_mood,
bin_mood,
opened,
ref Pos cpos { current position },
string term { string terminator },
Conv conv { character conversion key },
proc(ref File)bool logical_file_mended,
physical_file_mended,
page_mended,
line_mended,
format_mended,
value error mended,
proc(ref File,ref char)bool char_error_mended);
The idea being that if mode File were pub(lished) in a module, the
names of its fields would NOT be published, so that users of that
module could not then:
FIle foo;
{...}
Channel c = chan OF foo;
--
Chris Hermansen · clhermansen "at" gmail "dot" com
C'est ma façon de parler.
More information about the Algol68
mailing list