[Oberon] System.Directory options
andreas_pirklbauer at yahoo.com
Wed Nov 1 20:58:15 CET 2017
> On a more general basis, the character "!" was clearly a
> hack. It was meant an as exception to otherwise clean rules.
> Apparently, clean rules led to restrictions, and the real
> life prevailed.
Yes, it’s always been a hack - and one that got worse over
time, not better, unfortunately. Back in 1988 there was in
fact no ! option. Then an option stored in a global variable
diroptions was added pretty soon by someone. See the 1992
and 2005 Editions of the book Project Oberon, which state:
IF diroption = "d” THEN (*<--- global variable*)
Texts.WriteString(W, " “);
Texts.WriteDate(W, hp.time, hp.date);
+ hp.bleng - FileDir.HeaderSize, 8)
i := 0;
WHILE (ch > " ") & (ch # "/") DO
pat[i] := ch; INC(i); Texts.Read(R, ch)
pat[i] := 0X;
IF ch = "/“ THEN
Texts.Read(R, diroption) (*<—global variable*)
ELSE diroption := 0X
So the option was a variable ‘diroptions’ and not
yet packed into the pattern ‘pat'.
Then suddenly someone had the idea to pack the ! option
into the pattern itself (which is still the current
status quo), thereby eliminating the global variable
diroptions. Why was it done this way? I have no idea!
The clean solution would be:
1) to return to the original 1992/2005 approach with
a separate variable diroptions.
2) to generalize procedure System.GetArg such that
also accepts Unix style parameters -a, -b ..
All this exists in various places and in various
forms, e.g. regular expression parsers in Native
Oberon. It just isn’t part of Original Oberon -
which is a pity.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Oberon