So, to print or not to print?
Seb via Digitalmars-d
digitalmars-d at puremagic.com
Tue Apr 26 05:46:48 PDT 2016
On Tuesday, 26 April 2016 at 08:50:23 UTC, ixid wrote:
> Please find an example of a newcomer who would be confused by
> print. This is an objectionable argument because none of the
> people making it are newcomers, you're using an entirely
> theoretical newcomer as your argument, and seem to think
> 'print(a, b, c);' is going to confuse people more than
I can out myself as a newcomer (since February) and a lot of
stuff in D is pretty confusing. For example - a bit related - the
separation between std.stdio and std.file. At least I expected
that I can use `writeln` on files :/
There are already many other parts that require explanation, so
please let stdio be a simple module.
Btw to prove the point that two names are bad, let me give you
`AliasSeq` and `TypeTuple`.
On Tuesday, 26 April 2016 at 12:18:11 UTC, cym13 wrote:
> Finally it doesn't bring much. One learns writeln, laments a
> bit that it doesn't put spaces itself then just accepts it. I
> do think that easing the path of newcommers is important,
> I don't think print is a good way to do that. I'm all with
> J.M.D there.
I do agree with cym13, J.M.D, Jack Stouffer, rikki, klickverbot
;-)
> Regardless, even having two printing functions requires that
> programmers learn what the differences between them are. Each
> one added to the mix is yet another one whose slight
> differences has to be distinguished from the others. And we
> already have 4 of them - write, writef, writeln, and writefln,
> which is arguably too many. But at least they have a sensible
> naming scheme that helps distinguish them. print, on the other
> hand, has nothing in common with them and no indicators in its
> name how it differs from the others.
>
> Honestly, I see no value whatsoever in print. writefln already
> does the same job and in a clearer manner.
Or `writeln(chain(a, b, c).join(','))`.
However a compromise could be to allow writeln!`,`(a, b, c, d,
e), but I guess for most of the cases `dump` is actually the
function that the user wants to use.
> If it was available today, I would certainly use it for more
> convenient debugging, however the version I proposed [1]
> seems more useful to me.
> Should I make a PR?
> [1]:
> https://github.com/dlang/phobos/pull/3971#issuecomment-208058229
As mentioned on github I would love to see a proper dump function
and this would be quite useful for newcomers.
More information about the Digitalmars-d
mailing list