[Oberon] Standalone BlackBox programs was: GUI programming inOberon.

Lars noreply at z505.com
Thu Mar 31 06:19:16 CEST 2016


On Wed, March 30, 2016 8:36 pm, Douglas G. Danforth wrote:
> TYPE String = POINTER TO ARRAY OF CHAR;
>
>
> That allows an arbitrary length string determined at run time.
> VAR string: String;
> NEW(string, 1000);
>

You are still defining a max of 1000. Just at run time.

Now it is even worse, because your code is bloated up with the
declarations (restrictions or constraints) as code, instead of it being a
declaration at the top of your source. So instead of your program focusing
on the problem at hand, your code is filled and riddled with string code.
This was the problem with C language in the 1970's all the way up to today
where people still use C for application development (I have no idea why).

People riddle their code with string allocations instead of the
application being filled with useful code that needs to be seen by
developers. The application ends up being flooded with string allocations
that should have all been automated, since 1995 or whenever Ansistring
technology emerged (delphi 2.0?)

But I've already discussed my issues with oberon many times regarding that.

Arbitrary would be:

s := NEW(string);
s := "do whatever"
s := s + " you want"

But the question is, why even bother with the "NEW".

In mathematics, do you go:

X := NEW INTEGER(2)
Y := NEW INTEGER(40)
X + Y = 42

In math you just go:

X = 2
Y = 40
X + Y = 42

There is no "NEW" all over your maths texts.

That's another interesting issue: is mathematics strongly typed and
statically typed? It seems like mathematicians use type inference when
they write on the chalk board. Mathemeticians may say "X is a whole
number" however they often skip this step and just say "X=6" without
declaring it first. Interesting. Maybe that's why so many mathematicians
use languages like python or mathematica instead of oberon.

"Is there a need for the Mathematica language to be strongly typed like
C++? No. It is used to generalise and automate tasks and for deeper
problem understanding and solving."

That's not my opinion, just a quote from a website.
Should math be strongly statically typed?
Should mathematicians have to declare their variables before talking about
them further? Mathematics seems always about quick shortcuts and terse
expressions, rather than verbose long form time consumers.  I wonder if
it's why a lot of mathematicians simply do not use oberon, and use
dynamically typed languages instead.

>
> or you can do
>
> string := NewString ('Hello, world!');
>
> where
>
> PROCEDURE NewString (IN x: ARRAY OF CHAR);
> VAR string: String;
> BEGIN
> NEW(string, 1+LEN(x));
> string$ := x$ RETURN string
> END NewString;
>

This should all be automated. No programmer should have to spend his time
doing these sorts of things IMO. It's very similar to 1970 C programming
where you had to allocate your pointers to chars. It's a little higher
level than C and safer, but compared to using a delphi string back in
1990's over 20 years ago, are we this far behind in computing technology
that we have to manually do this sort of thing just to work with a string?

Imagine with integers you had to do this:

NewInteger(i, 0, 500)

Where 0 defines the minimum value of the integer, and 500 defines the max
value it can be.

A run time integer. But why? Imagine a mathematics text riddled with these
declarations:

NewInteger(x, 40)
NewInteger(y, 2)

Why would a mathematician want his maths text to be as verbose as this
when he could simply go:

x = 40
x = 2

And it is just as clear.

Similarily:

x + y = 42

is much clearer than

NewInteger(x, 40) + NewInteger(y, 2) = 42

Less is more.

s := "anything I want" + " this string to be"

Compared to:

s := Concat(NewString("anything I want"), NewString(" this string to be"));

Horrible.


More information about the Oberon mailing list