On Tue, 20 Sep 2016, Sven Schreiber wrote:
Am 20.09.2016 um 07:37 schrieb Riccardo (Jack) Lucchetti:
> On Mon, 19 Sep 2016, Allin Cottrell wrote:
>> I'd be interested to hear what people think of the comparison. If lots
>> of people tell me they still think printf sucks, than I guess I'll
>> have to rethink.
>
> I'm a huge fan of (s)printf, so keeping it or not is not a meaningful
> question IMO. Of course it has to stay, if only in the interest of
> backward compatibility.
>
> The issue here is: is it desirable to have a "dumbed down" version of
> printf?
Exactly. It seems to me everybody in this poll was answering the question
"Should printf() be replaced?". Which was never my intention.
The point is whether or not to *add* a simpler version for simple stuff.
I agree, and sorry I wasn't clearer. The idea behind my "poll" was
not to ask, Should we replace printf with something else? but
rather, Do we need to provide an alternative to printf for formatted
output?
We may not be able to reach consensus on this, but let me try a
little further. At present we have three commands in this
neighbourhood: print, printf and eval. Some might say that's already
too many (though actually I wouldn't agree, for reasons I've tried
to explain up-thread). However, surely it ought to be enough! And in
particular, I really don't want to introduce into hansl a
"competitor" to printf -- because, as I've already said, I think
that printf is the better design for complex mixtures of text and
numerics (though of course everyone doesn't have to agree with me on
that).
That said, I can see a case for making it easier to output very
simple stuff such as a string followed by a scalar on the same line.
In git there's an experiment to this effect; here's an example:
<hansl>
set echo off
set messages off
answer = 42
print "The number of roads a man must walk down is " -n
eval answer
</hansl>
The option -n (long form "--no-break") tells "print" not to add a
line-break; therefore the "eval" output follows directly:
<output>
The number of roads a man must walk down is 42
</output>
I don't know if anyone will consider this worthwhile. Certainly, one
can imagine a command that would produce the same effect with a
single line of input -- but, trust me, that would have to a new,
fourth, printing command; it could not be "print," on pain of
throwing away its facility to print the values of as many variables
as you like, given just their space-separated names.
Allin