[Oberon] RISC.img

Jan de Kruyf jan.de.kruyf at gmail.com
Fri Nov 6 11:06:36 CET 2015


Paul, I fully agree with your reasoning. Historically speaking.

But perhaps we should now enter the realm of the language wars :). I am
used in Ada to call a spade a spade. and I have found that is for good
reasons: It stops me from being stupid.

Here is an existing example in the RISC distribution:
At the moment in ORG.Mod a filename is defined as:

name: ORS.Ident;

in ORS.Mod ident is defined as

 TYPE Ident* = ARRAY IdLen OF CHAR;

and IdLen is then ultimately defined as 32 . And in an obvious place too,
where it is easily changed by the unaware. And it does not say there, that
it effects the length of a file name.

So excuse my french, but to me this is an unholy mess only for the sake of
not exposing FileDir.

And the good news is that we only need to add 1 line to Files.Mod to
alleviate this type confusion:

TYPE FileName* = FileDir.FileName;

Now all of a sudden we can work in some reasonable typesafe way. I
understand that the system can still be abused,
but at least now the obvious thing to do is right there in Files.mod.

End of suggestion.

2. Question:
I see that the 'numerical' CASE implementation is missing in ORP.Mod,
although it is in the language spec and although we might reasonably expect
people to port programs from O2 to O7.

Would it be in the interest of the community for me to try and implement
that part, at least for constant labels?

I am aware that 1. a table driven CASE might take up some codespace and 2.
that coding it as an IF THEN ELSIF THEN
will bring no speed advantage. But at the same time there are many
instances where a CASE statement is easy to write and convenient to read.

3. Question:
Why does the numerical CASE have no ELSE part anymore in O7. It is a very
convenient error catcher. (i.e. when not all cases are catered for, the
program does not silently fall through without warning.)

Cheers,

j.



On Thu, Nov 5, 2015 at 11:15 PM, Paul Reed <paulreed at paddedcell.com> wrote:

> Hi Jan,
>
> > But it seems that the FileDir symbolfile is missing in the Risc image.
> > I dumped the strings in the image, but it is not to be found.
>
> The downloadable image is intended to be as small as reasonably possible,
> obviously other things may be added to the system e.g. by compiling, but
> they will differ depending on who you are and what you want to do.
>
>
> > At the same time I like to have it available so a FileDir.FileName can be
> > specified as just that.
>
> If you haven't already (or if you're like me, even if you have!), you
> should definitely read Chapter 7 of the book carefully and then decide if
> you still want to do this.
>
> As the chapter points out, Files is the user filesystem API, accepting,
> for example, strings as filenames (and checking them).  Conversely,
> FileDir exposes the innards to system programmers only, and uses
> fixed-length filename structures which often also appear on-disk.
>
> Hence you probably don't want to propagate FileDir internals (or data
> structures based on them) down (up) the module hierarchy.
>
> Without knowing what you want to do, I hope that at least helps a bit.
>
> Cheers,
> Paul
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20151106/9d560f27/attachment.html>


More information about the Oberon mailing list