On 2/4/2012 9:08 AM, bearophile wrote:
About Bjarne Stroustrup's talk "C++11 Style":
I have appreciated (slide 22, at about 26.22) the stress on SI units, to use
the type system and the new C++11 feature to some avoid some bugs with zero
run-time cost. D requires a less natural syntax for them.
C++ allows for user-defined literals, such as:
30sec
The D equivalent would be:
sec!30
The C++ version is a bit hackish in that it relies on sec being a global
function. There's no opportunity for scoping, encapsulation, etc., and if two
different libraries defined overloads for sec on int, you're just stuck.
We'll see how this unfolds in practice.
The D version does not have these issues (and is not even a special feature -
it's just another way to use an existing feature).