string initialization question.

dcoder blah at blah.com
Fri Jul 30 14:13:15 PDT 2010


== Quote from Jonathan M Davis (jmdavisprog at gmail.com)'s article
> A makeArray() function wouldn't hurt any, but I don't think that it would really
> buy us much. Of course, truth be told, I've always thought that the ability to
> construct a string or vector in C++ all of a single value was pretty useless.
> Obviously, some people find it useful at least once in a while, but I've never
> had much use for it. A makeArray() function would probably still be a good thing
> to have, but what we really need here is either a syntactic way to do it or for
> the compiler to optimize out the useless initialization (as well as inline
> makeArray()) so that you don't have to deal with the extra cost of setting
> everything twice.
> - Jonathan M Davis

If I'm writing a program that pretty prints tree data, or output of sql, like
Oracle's sqlplus, or postgres equivalent, I find having such a utility
function/constructor a pretty handy feature.

I don't know where such a tool should finally be placed in D, but I having it
available as a library or as part of the language would be great.  It seems like a
lot of other languages have it like python, perl, C++, and Java.  So it can't be
that useless.



More information about the Digitalmars-d-learn mailing list