Making mistakes and fixing them is part of programming. But I
would prefer a syntax that is easy to read over one that is not.
I really dislike
PrintLn(a, b, c, d)
Print(a, b, c, d, \n)
If one cannot find and fix a missing \n, then one probably should
find a hobby (or career) other than programming
IMHO, of course. Goes without saying
On 10/5/2020 12:48 PM, Jordan Brown
On 10/5/2020 8:08 AM, Rogier Wolff
you get to chose what "printf" does, you can say: most people
will want the trailing \n, so we'll tack it on for them. Not the
right choice: supplying the \n in the format string is simple
and easy, but the other way around is not: If your printf adds
the \n at the end it is NOT easy to make a printf-without-\n out
If it wasn't for the huge number of bugs where programs forget to
include a \n, or include one where it's not appropriate, I'd agree
with you. But people get this wrong *all* the time. I think it
would have been better to have a function that prints a line (with
line termination, whatever that is) and an otherwise similar
function that prints a partial line without termination. That's
what Java did with print() and println(). I have to bet that Java
programs have many fewer of that class of bugs than C programs,
because Java programmers have to make an explicit and obvious
choice. I think Java got it slightly wrong, by having "print" be
the less common form; I think BASIC and sh got it right by having
the printing statement (print, echo) default to printing a line,
and optionally *not* terminate it.
I think the best strategy is to have the usual case be easy and
obvious, and the advanced case be possible.
You're making this about the specifics about just an example. That's
not the issue.
The thing is that from a print you can easily turn it into a function
that does println. That's function declaration and one or two lines.
In openscad, if the language provides a "for" that results in several
objects, you can easily make it into a for that returns the union
between those objects: union () for (...) ... But the other way is
tricky. So IMHO it would've been nicer to have chosen the "for returns
multiple objects" behaviour.
** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110 **
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
f equals m times a. When your f is steady, and your m is going down
your a is going up. -- Chris Hadfield about flying up the space shuttle.