[clean-list] Maybe I should change my job and apply for the pope-position

Siegfried Gonzi siegfried.gonzi@kfunigraz.ac.at
Fri, 12 Oct 2001 10:09:49 +0200


[As a deliverer of a service -- and Clean is in some view a service to a
community -- it shouldn't surprise you that people always will complain.
But this is normal and under this view you should read the following!]

Before I release my file-handling program I bother with the following:

How can one deal in Clean with numeric formatted output?


--Try to write the following to a file:

{{1.0,2.34,4.567,0.0},{0.9,7.896,2.34,5.67}}

And you will get:

1	2.34	4.567	0
0.9	7.896	2.34	5.67

There is a clear inconsistency, because I do not expect that 1.0 will
appear as 1. 
This is highly inconsistent, especially in a type-strict language.

a) Question 1: Is there a way to force Clean to write 1.0 and not 1?

-- Next turn:

Question 2: Why isn't it possible to write the following to an output
file?:

1.000	2.340	4.567	0.000
0.000	7.896	2.340	5.670


When you write with "freadr" to a file, you always write the textual
representation. 
And also the usage of writing strings and converting the Reals to
Strings would
be  not of great help (you will end up at the same vein).

In the complete manuals I cannot find a solution to this. Surely, there
would be
a solution to convert to a String, create a String array with zeros
(which denotes
the precision) and fill up the required precision. But the bill will not
pay off. 
What about the case:

Start = toString(1.23243432432E14)

Curiously enough you will get: "1.23243e+14"

Or you have to take care about the round-off-errors, and so on.



So, this solution is completely mad and I would get a red head when I
have to say this
to a C or Fortran programmer. Surely, I would deserve every medal on
this earth, because
the C or Fortran programmer will never stop laughing the rest of his
life and therefore cannot
pollute the earth with C and Fortran code.


Is there a workaround in Clean? *I cannot believe, that this has not
been included in the
Clean design strategy.*

Sorry, but formatted output is so common in science that nobody on earth
would expect a (high
level) programming language where this has not been  included.

*Otherwise Clean would be useless in this respect.* And not only in this
respect, it would be useless
for projects like:
A half year ago I wrote a C program for an amateur astronomer (story
behind is irrelevant). The
program reads in values from solar-amateur-astronomers, does some
calculations on arrays and write
some parameters for every observer to a file. 
And now I think on Clean: everything would had gone right until the
point when it comes to the
output. And there has been the requirement to write the Reals only with
2 decimal points to the file.

I have to emphasize a second time: the above problem is not a suggestion
you must solve, it is a requirement
you must solve! Otherwise you will scare away the last few Clean
programmers, who want to use Clean in a 
serious sense and not as a toy.

And for a third time: Please be conscious of the above elaborated
problem (and solve it as
fast as possible; everybody will more appreciate a solution to formatted
output as the delivering
of the Clean 2.0 compiler). 
As I wrote in a private mail: Every (or most) C or Fortran programmer
will bow out in milliseconds, 
when he has to deal with formatted output and will look into the Clean
manuals and will not find 
anything about this topic.


Maybe there are hundred of Clean users who abandoned Clean because of
this shortcomming!

It is highly debatable that I rant here about; especially because as an
academic-user I do not (or have not)
to pay for a Clean license. But imagine my person as a manager of a
software company. As a manager I am a looser, but the last 10 years I
red every second day that functional-programming is
superior and excels. So, my decision after 10  years is to move on
(starting from C) to Clean. My
employees are sceptical, so I will let them evaluate Clean for six month
and the programmers will then have
the possibility to vote for C or Clean.
And now we can bet what they will vote for, when I (as boss) expect
every second day a formatted output.
Surely, my programmers could cheat me and calculate with Clean and
refine the file with Perl (under my 
non-never-Perl-user assumption, that Perl can handle this). But the case
the calculations are not really time intensive, what would they impede
not to use Perl exclusively in
combination with C? 

Or do I estimate everything wrong? Are people arguing: the right tool
for the right job? Clean as a language
above the heaven with a very, very tiny slit to the outside world, and
all the other software tools in
combination  to hide this situation?


Dennoch: Friede in die Niederlande vom ehrwuerdigen Korrespondenten aus
Oesterreich.
S. Gonzi