Last update May 27, 2015

Languages Versus D

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.

FeatureDCC++C#JavaDelphiEiffelAdaHaskellSatherCommon LispSmalltalkPerlPythonRuby
Static typingYesYesYesYesYesYesYesYesYesYesOptional (Lib)NoNoNoNo
Dynamic typing/polymorphism NoPolymorphic    PolymorphicPolymorphic DynamicDynamic DynamicDynamic
Garbage CollectionYesNoNoYesYesNoYesUnspecYesYesYesYesYesYesYes
Strong typedefsYesNoNoNoNoYes YesYesYesN/AN/AN/AN/AN/A
AliasesYesYesYesYesFor Objects OnlyYesYesYesYesYesYes YesYesYes
ConstantsYesNoYesYesFor Non-Objects? OnlyYes Yes Yes     
Value typesDCC++C#JavaDelphiEiffelAdaHaskellSatherCommon LispSmalltalkPerlPythonRuby
Typed Enumeration/BooleanYesYes (booleans)YesYesYes (v1.5)YesYesYesYesYesKeywordsLib  Yes (booleans)
Long double floating point (80bit)YesYesYesLibNoYes YesYesNoMostMost Yes (no single precision floats) 
Complex and ImaginaryYesYesLib (std.)LibNoNo YesStd. Lib.YesYesMostLibYesLib
Rational NoNo Lib   Std LibYesYesYesLibNoLib
Arbitrary Precision Arithmetic NoNo Lib (std.)   YesIntYesYes Stdlib 
Regular ExpressionLibLibLibLibLib (std., v1.5)LibLibLibStd. Lib.LibLibLibYesLibYes
ArraysDCC++C#JavaDelphiEiffelAdaHaskellSatherCommon LispSmalltalkPerlPythonRuby
Lightweight arrayYesYesYesNoNoYes YesLibNoYesYesNoLibNo
Array bounds checkingYesNoStdlibYesYesYesYesYesYesYesYesYesYesYesYes
Resizable array / VectorYesNoStdlibYes (v2)Yes (v1.6)YesYesNoLibYesYesYesYesYesYes
Array slicingYesNoStdlibNoLib (std.)YesYesYesLibNoYesYesYesYesYes
Array of bits / Finite setYesNoYesNoLib (std.)YesYesYesLib YesYesLibNoNo
Other Data ModelsDCC++C#JavaDelphiEiffelAdaHaskellSatherCommon LispSmalltalkPerlPythonRuby
List LibLibLibLibLibLibLibYesLibYesYesYesYesYes
HashYesNoLib (std.)LibYes (Object), Lib (std. Map)NoLibLibLibLibYesYesYesYesYes
Abstract collection NoNoNoYes (v1.6)Yes (TCollection)         
FunctionsDCC++C#JavaDelphiEiffelAdaHaskellSatherCommon LispSmalltalkPerlPythonRuby
Function delegatesYesNoNoYesNoYesYesNoYesNo YesYesYesYes
Function overloadingYesNoYesYesYesYesNoYesYesYesYesYesYesNoNo
Out function parametersYesYesYesYesNoYesNoYesN/AYesYesNoYesNoNo
Nested functionsYesNoNoNoSort of (local inner classes)YesNoYesYesNoYesYesNoYesYes
Function literalsYesNoNoYes (v2)Sort of (anon. inner classes)NoYesNoYes YesYesYesYesYes
Dynamic closuresYesNoNoNoNoYes YesYesYesYesYesYesYesYes
LexicalClosuresNoNoNoYes (v2)Limited (anon. inner classes)No NoYesYesYesYesYesYesYes
Currying (unclear, is this currying or partial application?)LibNoNoNoNo Yes Yes Lib  Yes 
Non-class functionsYesYesYesNoNoYesNoYesYesNoYesYesYesYesYes
OOPDCC++C#JavaDelphiEiffelAdaHaskellSatherCommon LispSmalltalkPerlPythonRuby
Single InheritanceYesNoYesYesYesYesYesYesSort ofYesYesYesYesYesYes
Multiple InheritanceNoNoYesNoNoNoYesSomeSort ofYesYesSomeYesYesSort of
InterfacesYesNoYesYesYesYesYesYesYesYesN/A (generic functions, maybe?)LibLibNoN/A
Fine grain export controlpublic, private, etcstaticpublic, private, etcpublic, private, etcpublic, private, etcpublic, private, etcspecify classesprivate sectionyes  No No 
Inner classesYesNoSomeNoYesNoNoYesN/A SomeSomeNoYesYes
Mixins         YesYesLib   
Operator overloadingYesNoYesYesNoSlowYesYesYesYesN/AYesYesYesYes
First Class Types/Classes NoNoSome (new class loader)NoNoNoNo  YesYesYesYesYes
Covariant return typesYesNoYesNoYes (v1.5)NoYesYesYesYesYesYesYesYesN/A
GenericsYesNoYesAlmost (v2.0)Almost (v1.5, compile-time only)NoYesYesYesYesYesYesYesN/AN/A
Active Data Models               
Lambda-expression/functor NoYes (C++09)Yes (v3)NoNoNoNoYes YesYes (blocks) YesYes (blocks)
MonadsNoNoNoNoNoNoNoNoYes Lib    
Multilevel programmingDCC++C#JavaDelphiEiffelAdaHaskellSatherCommon LispSmalltalkPerlPythonRuby
Templates or executable macrosYesNoYesNoNoNoNoYesYesYesYesN/AN/AN/AYes
Higher Order Functions NoNo    NoYes YesYesYesYesYes
Reflection/IntrospectionRTTINoRTTIYesYesRTTINoNoLib YesYesYesYesYes
Dynamic function creation NoNo    No  YesYes   
Dynamic inheritance change NoNo Some (new class loader)  No  YesYes   
Dynamic class creation NoNoYes (v2)Lib  No  YesYesYes  
Dynamic method creation NoNoYes (v2)Some (new class loader)  No  YesYes   
Dynamic class loadingNoNoNoYesYesYes NoLibNoYesYesYesYesYes
Dynamic class unloading NoNo Some (new class loader)  No  YesYes   
Dynamic method loading NoNo No  No  YesYes   
Dynamic method unloading NoNo No  No  YesYes   
Dynamic structure change (add/rem slots) NoNo No  No  YesYes   
Multiple dispatchNoNoNoNoNoNoNoNoYesNoYesNoNoNoNo
PerformanceDCC++C#JavaDelphiEiffelAdaHaskellSatherCommon LispSmalltalkPerlPythonRuby
Inline assemblerYesYesYesNoNoYesNoYesLibNoMostSomeLibNoNo
Direct access to hardwareYesYesYesNoSome (JNI)Yes YesYesNoSomeSomeNoNoNo
Lightweight objectsYesYesYesYesSome VMsYes YesYesNoSort ofYesNoNoNo
Explicit memory allocation controlYesYesYesNoLib (VM std. interface)Yes YesLibNoSomeNoNoNoYes
Independent of VMYesYesYesNoRare (some vendors)YesYesYesYesYesMostSomeNoNoNo
Direct native code genYesYesYesNoSomeYesYesYesYesYesMostMostNoNoNo
First Class Continuations          SomeSome  Yes
Lazy Evaluation MostMost  Yes  Yes  Lib   
Implicit Parallelism/SchedulingSeq onlyWeak seq onlySeq onlySeq onlyLimitedSeq onlySeq onlySeq onlyParallelSeq onlyParallelSeq onlySeq onlySeq onlySeq only
ReliabilityDCC++C#JavaDelphiEiffelAdaHaskellSatherCommon LispSmalltalkPerlPythonRuby
Design by ContractYesNoNoNoLib (annotations and classloader, v1.5)NoYesYes (Ada 2012)NoYesLib (3rd party)NoNoNoNo
Unit testingYesNoLibNoLibLib NoLib YesYesLibYesLib
Static construction orderYesNoNoYesYesYesYes    YesYes  
Guaranteed initializationYesNoNoYesYesYesYesNoYesYesYesYesN/AYes 
RAIIDepr.NoYesYesNoYes Yes YesYesYesYesYes 
Explicit memory allocation controlYesYesYesNoNoYes YesNo NoNoNoNoYes
Exception handling (try-catch blocks)YesNoYesYesYesYesYesYesYesYesYesYesYesYesYes
try-catch-finally blocksYesNoN/AYesYesYesYesNoYes YesYesYesYesYes
Exception handling (restarts) NoNo No     Yes    
Thread synchronization primitivesYesNoNoYesYesYesYesYesYes MostYesLibYesYes
Tail Call Elimination        YesNoSomeSome   
Stack Control (Catchable Recursion Exception)        Yes (predictive) SomeSome   
Compatibility with CDCC++C#JavaDelphiEiffelAdaHaskellSatherCommon LispSmalltalkPerlPythonRuby
Support all C typesYesYesNoNoNoNoNoNoNoNoSomeSomeNoLibNo
Direct access to CYesYesYesSome (JNI)NoYesYesYesYesYesMostSomeLibLibNo
Struct member alignment controlYesMostNoNoNoYesNoYesNoNoNoSomeNoNoNo
Generates standard object filesYesYesYesNoNoYesYesYesYesNoOneSomeNoNoNo
Independent of macro preprocessorYesNoNoYesYesYesyesN/AYesYesYesYesYesYesYes
OtherDCC++C#JavaDelphiEiffelAdaHaskellSatherCommon LispSmalltalkPerlPythonRuby
Conditional compilationYesYesYesYesSome (mandatory dead code elimination)YesYesNoYes YesSomeSort ofN/AN/A
String switchesYesNoNoYesNoNoYesNoYesNoYesperform:LibN/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


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"
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
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.
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
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


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: May 27, 2015 19:15 (diff))