Kevin Bealer wrote:
Walter Bright Wrote:
Kevin Bealer wrote:
To smooth this out, it would help to have the best practices for
doing common things in D (e.g. serialization, logging) somewhat
documented for the consumption of non-experts. I wonder what a good
way of doing this is?
It's really impossible to predict what the best practices would be. Only
time and usage will tell. The "best practices" for both C and C++ have
evolved significantly over time.
I think D2 is so different from D (and in some important ways, from everything
out there) that a new usage style would have needed to be created even if D was
already the lingua franca.
The question that I find myself thinking is -- is chaos better or is it better
to try to establish a particular style of programming (however simply or
poorly) in the original books and resources that a programmer will find upon
discovering D?
Chaos has its appeal of course, but others would say that any initial style
that will stick is better than no style. In other words, that you cannot
evolve until you cohere. It's hard to choose... On the other hand I suppose
Phobos is consistent enough with itself that if people follow that they will
have a launch point.
If naming guidelines are a part of the "coding style" you mention, then
Phobos isn't very consistent. I think this needs to be fixed before TDPL
comes out, even though the renaming will cause major breakage. This is
the last chance to get it right.
Some examples:
- function naming:
std.file.isfile()
std.math.isFinite()
std.thread.thread_suspendAll()
- enum naming
std.file.SpanMode { shallow, depth, ... }
std.getopt.config { caseSensitive, caseInsensitive, ... }
std.json.JSON_TYPE { STRING, INTEGER, ... }
std.thread.State { HOLD, EXEC, ... }
-Lars