octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: let's keep printf, puts, and scanf


From: siko1056
Subject: Re: let's keep printf, puts, and scanf
Date: Wed, 20 Apr 2016 13:04:17 -0700 (PDT)

Dear Mike and jwe,

My intention was neither to vandalize Octave, nor to break the API today.
The cset got backed out, so there is no need to hurry now.

While adapting the documentation, I realized, how many redundant functions
Octave has to do the very same thing:

puts (str) === fputs (stdout(), str) === fprintf(stdout(), "%s", str)
printf(...) === fprintf(stdout(), ...)
scanf(...) === fscanf(stdin(), ...)

and some more.

Another observation is, that the Octave language has the nice feature to
make 2 real implementations and 4 convenience m-file wrappers to get all the
work done. Instead Octave currently provides 6 "real" (more redundant)
implementations in file-io.cc. Means, if any serious error is detected, the
code has to be touched more than once! Needless to say, that the source file
with important code is bloated up to 3k lines of code, so it's harder for
newcomers to get into it.

There was the argument, that C programmers should feel "home" with these
convenience functions, but I don't, see for example:

fputs (fid, str) vs. int fputs( const char *str, FILE *stream )

Finally Matlab does not implement these functions, maybe of good reason,
too. So the compatibility argument doesn't apply.

The only argument to leave these function into Octave is, that these were
there for a long time, and all of us got used to these functions. An
argument, that should never be underestimated! My bad. Even the C API is not
able to get rid of this redundancy, as so many programs rely on it.

My intention was to get the users gently away from redundancy Octave really
doesn't need (I mean what is the difference in typing "printf" or
"fprintf"). With a major release every year, the functions will not be gone
till 2020, but the code is easier to learn now!

@Mike: you mean varargin{:}?
http://hg.savannah.gnu.org/hgweb/octave/file/96518f623c91/scripts/deprecated/usage.m
Can you explain, what this does better? I would like to mention this in
https://www.gnu.org/software/octave/doc/v4.0.1/Variable_002dlength-Argument-Lists.html
if it is not documented elsewhere.

Again, I did not want to offend anyone, or break anything! But yes my cset
was way to rude.

Best,

Kai



--
View this message in context: 
http://octave.1599824.n4.nabble.com/let-s-keep-printf-puts-and-scanf-tp4676397p4676399.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]