D vs C++
Walter Bright
newshound2 at digitalmars.com
Sun Dec 26 14:33:12 PST 2010
Jérôme M. Berger wrote:
>> 3. inline assembler
> I have almost never used inline assembler even in languages that
> support it. Of course, this is only a sub-point of your point 6:
> using inline assembly in a language as slow as Python would be
> completely pointless.
Inline assembly isn't just for speed. There are a lot of special system
instructions.
>> 4. immutability
>> 5. purity
> I would not count them as advantages per se. Some of their
> consequences might be seen as advantages once we have enough
> experience with them.
They are not new concepts, and have been well proven to be advantageous in other
languages.
>> 7. RAII
> Python has it too (since 2.6 IIRC, see the "with" keyword).
> Moreover, Python makes it clear that RAII is happening by requiring
> a special syntax at the call point.
The 'with' statement is extremely limited. For example, it can't be used in an
expression, as a function parameter, etc. I wouldn't call it RAII.
>> 8. direct interface to C
> Cython gives it too: it is as easy to write a Cython interface
> module as to write a D interface file for a C library.
Cython is a separate language from Python.
>> 9. templates
> Since Python uses duck typing everywhere, you could argue that
> everything in Python is a template.
Templates are far more than just generics.
>> 10. CTFE
> This is not an advantage per se. It is useful because it allows
> generative programming, so see point 11.
That happens at compile time.
>> 11. generative programming
> Python has that (like most dynamic languages) through "eval".
That happens at run time. D's happens at compile time.
More information about the Digitalmars-d
mailing list