Difference (last change)
(no other diffs,
normal page display)
Changed: 32,34c32,34
Array bounds checking; Yes@#green; No@#red; No@#red; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green
Resizable array / Vector; Yes@#green; No@#red; Lib (std.)@#yellow; Yes (v2)@#green; Yes (v1.6)@#green; Yes@#green; Yes@#green; No@#red; Lib@#yellow; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green
Array slicing; Yes@#green; No@#red; No@#red; No@#red; Lib (std.)@#yellow; Yes@#green; Yes@#green; Yes@#green; Lib@#yellow; No@#red; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green
|
Array bounds checking; Yes@#green; No@#red; Stdlib@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green
Resizable array / Vector; Yes@#green; No@#red; Stdlib@#green; Yes (v2)@#green; Yes (v1.6)@#green; Yes@#green; Yes@#green; No@#red; Lib@#yellow; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green
Array slicing; Yes@#green; No@#red; Stdlib@#yellow; No@#red; Lib (std.)@#yellow; Yes@#green; Yes@#green; Yes@#green; Lib@#yellow; No@#red; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green
|
Changed: 101c101
RAII; Yes@#green; No@#red; Yes@#green; Yes@#green; No@#red; Yes@#green; ; Yes@#green; ; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green;
|
RAII; Depr.@#red; No@#red; Yes@#green; Yes@#green; No@#red; Yes@#green; ; Yes@#green; ; Yes@#green; Yes@#green; Yes@#green; Yes@#green; Yes@#green;
|
LanguagesVersusD/PageDiscussion
This is an unofficial language comparison page created for some member of the D newsgroup.
If you know any of the unfilled languages, please fill in what you can!
Please note that the left columns - D over C descendants to Java - may not be changed until you have a good reason to. Besides, when filling in other languages, try to adhere to the same judgement as seen behind those 5.
Feature | D | C | C++ | C# | Java | Delphi | Eiffel | Ada | Haskell | Sather | Common Lisp | Smalltalk | Perl | Python | Ruby |
Static typing | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Optional (Lib) | No | No | No | No |
Dynamic typing/polymorphism | | No | Polymorphic | | | | | Polymorphic | Polymorphic | | Dynamic | Dynamic | | Dynamic | Dynamic |
Garbage Collection | Yes | No | No | Yes | Yes | No | Yes | Unspec | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Strong typedefs | Yes | No | No | No | No | Yes | | Yes | Yes | Yes | N/A | N/A | N/A | N/A | N/A |
Aliases | Yes | Yes | Yes | Yes | For Objects Only | Yes | Yes | Yes | Yes | Yes | Yes | | Yes | Yes | Yes |
Constants | Yes | No | Yes | Yes | For Non-Objects? Only | Yes | | Yes | | Yes | | | | | |
Value types | D | C | C++ | C# | Java | Delphi | Eiffel | Ada | Haskell | Sather | Common Lisp | Smalltalk | Perl | Python | Ruby |
Typed Enumeration/Boolean | Yes | Yes (booleans) | Yes | Yes | Yes (v1.5) | Yes | Yes | Yes | Yes | Yes | Keywords | Lib | | | Yes (booleans) |
Long double floating point (80bit) | Yes | Yes | Yes | Lib | No | Yes | | Yes | Yes | No | Most | Most | | Yes (no single precision floats) | |
Complex and Imaginary | Yes | Yes | Lib (std.) | Lib | No | No | | Yes | Std. Lib. | Yes | Yes | Most | Lib | Yes | Lib |
Rational | | No | No | | Lib | | | | Std Lib | Yes | Yes | Yes | Lib | No | Lib |
Arbitrary Precision Arithmetic | | No | No | | Lib (std.) | | | | Yes | Int | Yes | Yes | | Stdlib | |
String | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Regular Expression | Lib | Lib | Lib | Lib | Lib (std., v1.5) | Lib | Lib | Lib | Std. Lib. | Lib | Lib | Lib | Yes | Lib | Yes |
Arrays | D | C | C++ | C# | Java | Delphi | Eiffel | Ada | Haskell | Sather | Common Lisp | Smalltalk | Perl | Python | Ruby |
Lightweight array | Yes | Yes | Yes | No | No | Yes | | Yes | Lib | No | Yes | Yes | No | Lib | No |
Array bounds checking | Yes | No | Stdlib | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Resizable array / Vector | Yes | No | Stdlib | Yes (v2) | Yes (v1.6) | Yes | Yes | No | Lib | Yes | Yes | Yes | Yes | Yes | Yes |
Array slicing | Yes | No | Stdlib | No | Lib (std.) | Yes | Yes | Yes | Lib | No | Yes | Yes | Yes | Yes | Yes |
Array of bits / Finite set | Yes | No | Yes | No | Lib (std.) | Yes | Yes | Yes | Lib | | Yes | Yes | Lib | No | No |
Other Data Models | D | C | C++ | C# | Java | Delphi | Eiffel | Ada | Haskell | Sather | Common Lisp | Smalltalk | Perl | Python | Ruby |
List | | Lib | Lib | Lib | Lib | Lib | Lib | Lib | Yes | Lib | Yes | Yes | Yes | Yes | Yes |
Hash | Yes | No | Lib (std.) | Lib | Yes (Object), Lib (std. Map) | No | Lib | Lib | Lib | Lib | Yes | Yes | Yes | Yes | Yes |
Abstract collection | | No | No | No | Yes (v1.6) | Yes (TCollection) | | | | | | | | | |
Functions | D | C | C++ | C# | Java | Delphi | Eiffel | Ada | Haskell | Sather | Common Lisp | Smalltalk | Perl | Python | Ruby |
Function delegates | Yes | No | No | Yes | No | Yes | Yes | No | Yes | No | | Yes | Yes | Yes | Yes |
Function overloading | Yes | No | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes | No | No |
Out function parameters | Yes | Yes | Yes | Yes | No | Yes | No | Yes | N/A | Yes | Yes | No | Yes | No | No |
Nested functions | Yes | No | No | No | Sort of (local inner classes) | Yes | No | Yes | Yes | No | Yes | Yes | No | Yes | Yes |
Function literals | Yes | No | No | Yes (v2) | Sort of (anon. inner classes) | No | Yes | No | Yes | | Yes | Yes | Yes | Yes | Yes |
Dynamic closures | Yes | No | No | No | No | Yes | | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
LexicalClosures | No | No | No | Yes (v2) | Limited (anon. inner classes) | No | | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Currying (unclear, is this currying or partial application?) | Lib | No | No | No | No | | Yes | | Yes | | Lib | | | Yes | |
Non-class functions | Yes | Yes | Yes | No | No | Yes | No | Yes | Yes | No | Yes | Yes | Yes | Yes | Yes |
OOP | D | C | C++ | C# | Java | Delphi | Eiffel | Ada | Haskell | Sather | Common Lisp | Smalltalk | Perl | Python | Ruby |
Modules/Namespaces | Yes | No | Namespaces | Yes | Packages | Yes | No | Yes | Yes | No | Yes | Some | Yes | Yes | N/S |
Single Inheritance | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes | Sort of | Yes | Yes | Yes | Yes | Yes | Yes |
Multiple Inheritance | No | No | Yes | No | No | No | Yes | Some | Sort of | Yes | Yes | Some | Yes | Yes | Sort of |
Interfaces | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | N/A (generic functions, maybe?) | Lib | Lib | No | N/A |
Fine grain export control | public, private, etc | static | public, private, etc | public, private, etc | public, private, etc | public, private, etc | specify classes | private section | yes | | | No | | No | |
Inner classes | Yes | No | Some | No | Yes | No | No | Yes | N/A | | Some | Some | No | Yes | Yes |
Mixins | | | | | | | | | | Yes | Yes | Lib | | | |
Operator overloading | Yes | No | Yes | Yes | No | Slow | Yes | Yes | Yes | Yes | N/A | Yes | Yes | Yes | Yes |
First Class Types/Classes | | No | No | Some (new class loader) | No | No | No | No | | | Yes | Yes | Yes | Yes | Yes |
Covariant return types | Yes | No | Yes | No | Yes (v1.5) | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | N/A |
Generics | Yes | No | Yes | Almost (v2.0) | Almost (v1.5, compile-time only) | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | N/A | N/A |
Active Data Models | | | | | | | | | | | | | | | |
Lambda-expression/functor | | No | Yes (C++09) | Yes (v3) | No | No | No | No | Yes | | Yes | Yes (blocks) | | Yes | Yes (blocks) |
Monads | No | No | No | No | No | No | No | No | Yes | | Lib | | | | |
Multilevel programming | D | C | C++ | C# | Java | Delphi | Eiffel | Ada | Haskell | Sather | Common Lisp | Smalltalk | Perl | Python | Ruby |
Templates or executable macros | Yes | No | Yes | No | No | No | No | Yes | Yes | Yes | Yes | N/A | N/A | N/A | Yes |
Higher Order Functions | | No | No | | | | | No | Yes | | Yes | Yes | Yes | Yes | Yes |
Reflection/Introspection | RTTI | No | RTTI | Yes | Yes | RTTI | No | No | Lib | | Yes | Yes | Yes | Yes | Yes |
Dynamic function creation | | No | No | | | | | No | | | Yes | Yes | | | |
Dynamic inheritance change | | No | No | | Some (new class loader) | | | No | | | Yes | Yes | | | |
Dynamic class creation | | No | No | Yes (v2) | Lib | | | No | | | Yes | Yes | Yes | | |
Dynamic method creation | | No | No | Yes (v2) | Some (new class loader) | | | No | | | Yes | Yes | | | |
Dynamic class loading | No | No | No | Yes | Yes | Yes | | No | Lib | No | Yes | Yes | Yes | Yes | Yes |
Dynamic class unloading | | No | No | | Some (new class loader) | | | No | | | Yes | Yes | | | |
Dynamic method loading | | No | No | | No | | | No | | | Yes | Yes | | | |
Dynamic method unloading | | No | No | | No | | | No | | | Yes | Yes | | | |
Dynamic structure change (add/rem slots) | | No | No | | No | | | No | | | Yes | Yes | | | |
Multiple dispatch | No | No | No | No | No | No | No | No | Yes | No | Yes | No | No | No | No |
Performance | D | C | C++ | C# | Java | Delphi | Eiffel | Ada | Haskell | Sather | Common Lisp | Smalltalk | Perl | Python | Ruby |
Inline assembler | Yes | Yes | Yes | No | No | Yes | No | Yes | Lib | No | Most | Some | Lib | No | No |
Direct access to hardware | Yes | Yes | Yes | No | Some (JNI) | Yes | | Yes | Yes | No | Some | Some | No | No | No |
Lightweight objects | Yes | Yes | Yes | Yes | Some VMs | Yes | | Yes | Yes | No | Sort of | Yes | No | No | No |
Explicit memory allocation control | Yes | Yes | Yes | No | Lib (VM std. interface) | Yes | | Yes | Lib | No | Some | No | No | No | Yes |
Independent of VM | Yes | Yes | Yes | No | Rare (some vendors) | Yes | Yes | Yes | Yes | Yes | Most | Some | No | No | No |
Direct native code gen | Yes | Yes | Yes | No | Some | Yes | Yes | Yes | Yes | Yes | Most | Most | No | No | No |
First Class Continuations | | | | | | | | | | | Some | Some | | | Yes |
Lazy Evaluation | | Most | Most | | | Yes | | | Yes | | | Lib | | | |
Implicit Parallelism/Scheduling | Seq only | Weak seq only | Seq only | Seq only | Limited | Seq only | Seq only | Seq only | Parallel | Seq only | Parallel | Seq only | Seq only | Seq only | Seq only |
Reliability | D | C | C++ | C# | Java | Delphi | Eiffel | Ada | Haskell | Sather | Common Lisp | Smalltalk | Perl | Python | Ruby |
Design by Contract | Yes | No | No | No | Lib (annotations and classloader, v1.5) | No | Yes | Yes (Ada 2012) | No | Yes | Lib (3rd party) | No | No | No | No |
Unit testing | Yes | No | Lib | No | Lib | Lib | | No | Lib | | Yes | Yes | Lib | Yes | Lib |
Static construction order | Yes | No | No | Yes | Yes | Yes | Yes | | | | | Yes | Yes | | |
Guaranteed initialization | Yes | No | No | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | N/A | Yes | |
RAII | Depr. | No | Yes | Yes | No | Yes | | Yes | | Yes | Yes | Yes | Yes | Yes | |
Explicit memory allocation control | Yes | Yes | Yes | No | No | Yes | | Yes | No | | No | No | No | No | Yes |
Exception handling (try-catch blocks) | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
try-catch-finally blocks | Yes | No | N/A | Yes | Yes | Yes | Yes | No | Yes | | Yes | Yes | Yes | Yes | Yes |
Exception handling (restarts) | | No | No | | No | | | | | | Yes | | | | |
Thread synchronization primitives | Yes | No | No | Yes | Yes | Yes | Yes | Yes | Yes | | Most | Yes | Lib | Yes | Yes |
Tail Call Elimination | | | | | | | | | Yes | No | Some | Some | | | |
Stack Control (Catchable Recursion Exception) | | | | | | | | | Yes (predictive) | | Some | Some | | | |
Compatibility with C | D | C | C++ | C# | Java | Delphi | Eiffel | Ada | Haskell | Sather | Common Lisp | Smalltalk | Perl | Python | Ruby |
Support all C types | Yes | Yes | No | No | No | No | No | No | No | No | Some | Some | No | Lib | No |
Direct access to C | Yes | Yes | Yes | Some (JNI) | No | Yes | Yes | Yes | Yes | Yes | Most | Some | Lib | Lib | No |
Struct member alignment control | Yes | Most | No | No | No | Yes | No | Yes | No | No | No | Some | No | No | No |
Generates standard object files | Yes | Yes | Yes | No | No | Yes | Yes | Yes | Yes | No | One | Some | No | No | No |
Independent of macro preprocessor | Yes | No | No | Yes | Yes | Yes | yes | N/A | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Other | D | C | C++ | C# | Java | Delphi | Eiffel | Ada | Haskell | Sather | Common Lisp | Smalltalk | Perl | Python | Ruby |
Conditional compilation | Yes | Yes | Yes | Yes | Some (mandatory dead code elimination) | Yes | Yes | No | Yes | | Yes | Some | Sort of | N/A | N/A |
String switches | Yes | No | No | Yes | No | No | Yes | No | Yes | No | Yes | perform: | Lib | N/A (no switches, use hashmaps) | Yes |
|
"N/A" means "don't have meaning for this language"
"Sort of" - "partitially implemented"
"One", "Some", "Most" - number of language implementations having this feature
"Lib" - implemented by standard library
Definitions
I tried to pick useful definitions. This goes without saying, but feel free to amend them.
--AndyFriesen
I think ALL of 'em must be explained to make sure we have common terms. I've added some ambiguous or unknown to me. --VincentThorn
Don't forget that original of this page was created to praise D, so it still, even after all our modifications, contains strange features that are of interest only for whose seeking even smallest D advantages over C++/C#/Java. --BulatZiganshin
- Single inheritance
- Ability to inherit attributes (data fields) and methods (functions) from existing class when creating new one. Some languages inherit only methods, this marked as "Sort of"
- Multiple inheritance
- Ability to inherit attributes and methods from several classes when creating new one. Some languages allow multi-inheritance only for methods, this marked as "Sort of"
- Interfaces
- Classes limited to declarations of method signatures (parameters/result types). Each class "derived" from such interface must implement all these methods. Not applicable to languages with dynamic typing
- Modules
- Implicit scopes for every source file. Namespaces do not qualify, as they are evidently somewhat weaker. (though I would argue that they are freeform, not weak) --AndyFriesen
- Templates or executable macros
- Compile-time parameterization of declarations (which directly affect the code generated) and/or programmable code generation.
- Generics
- The ability to write algorithms and containers whose subject type is not set in stone. Can be either compile-time or runtime. Generics achieved by use of templates qualify.
- Syntax style
- C uses curly braces to define compound statements, Pascal - begin/end's, Lisp - Lots of Idiotic Silly Parentheses, and Python/Haskell - just naked spaces

- Strong typedefs
- ability to devalre new types that are internally equivalent to existing ones but compiler don't allow to use one instead other without explicit cast
- Covariant return types
- ability to declare return type of of function in subclass with another (more specific) type than was declared in super-class. For example, if class Aimal has function of type Aznimal returning its parent, then class Dog may have this procedure redefined as returning Dog and it's still may be called in virtual way
- Multiple dispatch
- When a polymorphic function is called, the specific function called is chosen at run-time based on all parameters and their run-time types. Contrast with single dispatch, where the specific function called is based on only one factor, for example, the relevant class object.
- Function literals
- using functions in expressions, e.g. passing a function with inline code as a parameter to another function
- Dynamic closures
- ??
- LexicalClosures
- Ability to create closure that "captures" variables existing at the program line where closure defined
- Lightweight arrays
- Arrays of basic types that holds only values of these types and don't have overhead, say 1000 int values should occupy 4000 bytes (on 32-bit cpu, i mean)
- Lightweight objects
- Objects that don't have any hidden data attached, like C structs
- Explicit memory allocation control
- like new/delete?
- Independent of VM
- compiled directly to cpu code, not to bytecode interpretd by VM (as in Java/C#)
- Direct access to C
- ability to link with C modules and use their functions/data. For example, C++ provides this using <extern "C"> declarations
- Independent of macro preprocessor
- C and C++ languages can't be used without preprocessor which includes files and defines macros. other languages can be used without CPP
- Conditional compilation
- language feature to conditionally compile parts of program w/o using preprocessor
- Fine grain export control
- ??
Related