On Sun, 18 Sep 2016, Sven Schreiber wrote:
Am 18.09.2016 um 21:04 schrieb Allin Cottrell:
> OK, maybe this just me, but personally I hate, despise and deplore the
> various supposedly "user-friendly" alternatives to C-style printf as
> found in Ox, R and some other languages. I find it terribly confusing to
> have to mix quoted string-literal chunks and variable names, all comma
> separated, in a single statement.
(Side remark: What _is_ confusing about string literals in hansl is the way
how literals are given without quotes in a foreach loop --as in "loop foreach
i peach pear plum"--, and probably in a few more places; but I've said that
before.)
Granted. There are some places in hansl syntax where we really
require a string literal (or a set of same) but in the interest of
(supposed) user-friendliness we accept an unquoted version of the
argument. I'm prepared to admit that was probably a mistake ;-)
It's a matter of taste of course, but Jack's experience
regarding user
feedback would seem to support my intuition about what people find
user-friendly.
OK, but I'm not sure that people always know what's good for them!
(See the US electorate's flirtation with Donald Trump.) The thing
is, those dumbed-down printf variants might look quite nice at first
-- say, if you have just one string and one variable to print -- but
they don't take you far, and in the end you have to learn printf
anyway. Try printing something that contains literal parentheses and
literal commas (not that unusual) and your head is soon hurting
badly unless you're using printf.
> With printf, you have a clear separation of just one string
literal, the
> format, and whatever variables or expressions you want to print.
I don't really see how the string literal can be called separated from the
format when the format spec comes right in the middle of the literal!?
Sorry, I guess I wasn't clear. What I meant is: the format == (the
only string literal in a printf call), unless one is perverse enough
to supply string literals as arguments, which should never be
necessary [*].
Allin
[*] Unless one is supporting multilingual output. That's routine in
the gretl C source code, but not something your average user is
attempting in hansl.