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

Srinivas Nayak sinu.nayak2001 at gmail.com
Thu Mar 31 09:03:02 CEST 2016


True Lars,

I too never declare a variable while using PHP.
Same, while programming in Bash.
But in C, I am forced to.

I think, in PHP and Bash, translator do the guess work for the programmer.
So it must be generating some code to support its guess work.
And in the languages that directly work with hardware,
where we can't afford such a piece of code, supporting our translator's guess work,
may be we declare variables beforehand.
I think, performance mania is the culprit to enforce declaration. Nothing else.

And yes, mathematicians...


My thoughts about them
======================
They are little different... Odd man out!
Whatever that suits them that is mathematics...
Or else what?

Ask them, what is GCD of 3.2 and 2.5?
They will say "Don't you know, this is UNDEFINED!"
Now ask, what is GCD of 12 and 9...
Here they will say, "You don't know this even? You are a graduate right?"

Now you keep quite and ask, "Surprising! Your GCD is defined for one example and not for other? How is this?"
They will say, "Come on. GCD is defined for whole numbers only".

Good... just because they said...

Now you ask again, what is GCD of -4 and -3?
[Immediately stay 2 steps away from them!]
They mush shout at you now, "Sssst. Listen carefully. GCD is defined for whole-positive-numbers ONLY."

Now what to do...
You become silent, hang your head down and whisper yourself, "You should have told this earlier!"


Moral is, never believe mathematicians.
Be careful when they look simple.
They are more strict and more type mania than they look.
Thing is that, they reveal the truth, ONLY when you poke!

When you don't poke, They program like this...

x = 2;
y = 3;
z = add(x, y);

When this doesn't print anything on screen, they modify this to

x = 2;
y = 3;
z = add(x, y);
int z;
int add (int, int);
int y;
int x;

When this even doesn't print anything on screen, with hesitation they modify this to

main()
{
x = 2;
y = 3;
z = add(x, y);

int z;
int add (int, int);
int y;
int x;
}
int main(void);

Done. They won't modify this any more!
And you know, with this much code, they want the program 1. to print the result on the CRT screen, 2. print the answer on an A4 size paper and at the same time 3. fax the result to their professor...
Why not? because in mathematics they never know doing anything like printf() or cout<< or System.Fax()!
And why after all they wrote "main"? Just because they heard it from a programmer that without "main" nothing works! Else, they wouldn't even care to write "main"!

I wish I would become a great mathematician, life so cool...
No rules... No regulations... I have the power to define things!
I can omit types, steps, hints, comments as much as I like,
I will float in a limit-less imaginary world, where my integers have no bound, my "Limit x tends to infinity"...and what not?
When people will ask, I will simply offer a smile at them!
And that naughty smile explains everything... "Come on. This is Mathematics!"

[My apologies to my mathematician friends, I am one among you too.
This is just to explain the nature of mathematics and its relation to Types.
Hope this will be just a light reading.]
=====================



With thanks and best regards,

Yours sincerely,
Srinivas Nayak

Home: http://www.mathmeth.com/sn/
Blog: http://srinivas-nayak.blogspot.in/

On 03/31/2016 09:49 AM, Lars wrote:
> 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.
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>


More information about the Oberon mailing list