Fudcon D programming
-
Upload
jonathan-mercier -
Category
Technology
-
view
263 -
download
1
Transcript of Fudcon D programming
![Page 1: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/1.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
.
......
D ProgrammingIn nutshell
Jonathan MERCIER
December 9, 2012
. .. 1/122.
D Programming .
.
.. . . Forward
![Page 2: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/2.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 2/122. .. 2/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 3: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/3.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Before starting
. .. 3/122. .. 3/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 4: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/4.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Why a new language?
.Few significant dates..
......
C++ 1983
Java 1990Python 1995Ruby 1995
And now?
. .. 4/122. .. 4/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 5: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/5.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Why a new language?
.Few significant dates..
......
C++ 1983Java 1990
Python 1995Ruby 1995
And now?
. .. 4/122. .. 4/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 6: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/6.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Why a new language?
.Few significant dates..
......
C++ 1983Java 1990Python 1995
Ruby 1995
And now?
. .. 4/122. .. 4/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 7: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/7.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Why a new language?
.Few significant dates..
......
C++ 1983Java 1990Python 1995Ruby 1995
And now?
. .. 4/122. .. 4/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 8: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/8.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Why a new language?
.Few significant dates..
......
C++ 1983Java 1990Python 1995Ruby 1995
And now?
. .. 4/122. .. 4/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 9: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/9.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
What is D programming?
D is a modern language programming inspired by:C++JavaHaskellPythonRuby
. .. 5/122. .. 5/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 10: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/10.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Why a new language?
.D Combines..
......
Modeling Power
Modern ConvenienceNative Efficiency
. .. 6/122.. .. 6/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 11: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/11.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Why a new language?
.D Combines..
......
Modeling PowerModern Convenience
Native Efficiency
. .. 6/122.. .. 6/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 12: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/12.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Why a new language?
.D Combines..
......
Modeling PowerModern ConvenienceNative Efficiency
. .. 6/122.. .. 6/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 13: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/13.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 7/122.. .. 7/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 14: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/14.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Object
.
......
Interface..
1 interface foo { …}
class..
1 class bar { …}
inheritance..
1 class bar: foo { …}
multi class inheritance not allowed, instead usedinterface.
. .. 8/122.. .. 8/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 15: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/15.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Object
.
......
Interface..
1 interface foo { …}
class..
1 class bar { …}
inheritance..
1 class bar: foo { …}
multi class inheritance not allowed, instead usedinterface.
. .. 8/122.. .. 8/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 16: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/16.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Object
.
......
Interface..
1 interface foo { …}
class..
1 class bar { …}
inheritance..
1 class bar: foo { …}
multi class inheritance not allowed, instead usedinterface.
. .. 8/122.. .. 8/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 17: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/17.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Object
.
......
Interface..
1 interface foo { …}
class..
1 class bar { …}
inheritance..
1 class bar: foo { …}
multi class inheritance not allowed, instead usedinterface.
. .. 8/122.. .. 8/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 18: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/18.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 9/122.. .. 9/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 19: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/19.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Functional
.
......
Data immutability
..1 immutable int[] a = [ 4, 6, 1, 2];
Pure functions..
1 pure int square(int x) { return x * x; }
Lambda functions..
1 a.sort!( (x,y) => x < y ); // [ 1, 2, 4, 6 ]
. .. 10/122.. .. 10/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 20: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/20.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Functional
.
......
Data immutability
..1 immutable int[] a = [ 4, 6, 1, 2];
Pure functions..
1 pure int square(int x) { return x * x; }
Lambda functions..
1 a.sort!( (x,y) => x < y ); // [ 1, 2, 4, 6 ]
. .. 10/122.. .. 10/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 21: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/21.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Functional
.
......
Data immutability
..1 immutable int[] a = [ 4, 6, 1, 2];
Pure functions..
1 pure int square(int x) { return x * x; }
Lambda functions..
1 a.sort!( (x,y) => x < y ); // [ 1, 2, 4, 6 ]
. .. 10/122.. .. 10/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 22: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/22.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 11/122.. . .. 11/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 23: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/23.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Meta-programming
.Combination of..
......
templates
compile time function executiontuplesstring mixins
. .. 12/122.. . .. 12/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 24: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/24.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Meta-programming
.Combination of..
......
templatescompile time function execution
tuplesstring mixins
. .. 12/122.. . .. 12/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 25: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/25.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Meta-programming
.Combination of..
......
templatescompile time function executiontuples
string mixins
. .. 12/122.. . .. 12/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 26: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/26.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Meta-programming
.Combination of..
......
templatescompile time function executiontuplesstring mixins
. .. 12/122.. . .. 12/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 27: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/27.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Meta-programming
..
Code 1: Example1 template Factorial(ulong n){2 static if(n < 2)3 const Factorial = 1;4 else5 const Factorial = n * Factorial!(n − 1);6 }7 const ulong var = Factorial!( 8 ); // compute at compile−time
. .. 13/122.. . .. 13/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 28: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/28.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 14/122.. . .. 14/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 29: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/29.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Parallelism
.
......
module to use..
1 import std.parallelism;
parallel loop
..1 foreach( i; parallel( list ) ){ …}
Pool thread
..
1 void myfunction( int param1, int param 2 ){ …}2 auto myTask = task!myfunction( param1, param2 );3 taskPool.put( myTask );4 doSomething(); // another work in parallel5 taskPool.finish( true ); // wait alls jobs ending
. .. 15/122.. . .. 15/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 30: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/30.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Parallelism
.
......
module to use..
1 import std.parallelism;
parallel loop
..1 foreach( i; parallel( list ) ){ …}
Pool thread
..
1 void myfunction( int param1, int param 2 ){ …}2 auto myTask = task!myfunction( param1, param2 );3 taskPool.put( myTask );4 doSomething(); // another work in parallel5 taskPool.finish( true ); // wait alls jobs ending
. .. 15/122.. . .. 15/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 31: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/31.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Parallelism
.
......
module to use..
1 import std.parallelism;
parallel loop
..1 foreach( i; parallel( list ) ){ …}
Pool thread
..
1 void myfunction( int param1, int param 2 ){ …}2 auto myTask = task!myfunction( param1, param2 );3 taskPool.put( myTask );4 doSomething(); // another work in parallel5 taskPool.finish( true ); // wait alls jobs ending
. .. 15/122.. . .. 15/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 32: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/32.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 16/122.. . . .. 16/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 33: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/33.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Ressource Management
..
Code 2: Example1 File f = File( ”myfile.txt”, ”r”);2 scope(exit) f.close();3 lockFile( f );4 doFoo( f );5 scope(success) doBar( f );6 scope(failure) unlock( f );
. .. 17/122.. . . .. 17/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 34: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/34.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 18/122.. . . .. 18/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 35: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/35.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Contract.
......
check a statement..
1 assert( var != null );
check before entering into a function
..
1 double foo ( int a )2 in{ assert( a > 0 ); }3 body { return a − 2; }
check at function exit
..
1 int foo ( int a )2 out{ assert( a > 0 ); }3 body { return a − 2; }
-release flag will not compute contract
..$ ldc2 -release foo.d
. .. 19/122.. . . .. 19/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 36: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/36.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Contract.
......
check a statement..
1 assert( var != null );
check before entering into a function
..
1 double foo ( int a )2 in{ assert( a > 0 ); }3 body { return a − 2; }
check at function exit
..
1 int foo ( int a )2 out{ assert( a > 0 ); }3 body { return a − 2; }
-release flag will not compute contract
..$ ldc2 -release foo.d
. .. 19/122.. . . .. 19/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 37: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/37.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Contract.
......
check a statement..
1 assert( var != null );
check before entering into a function
..
1 double foo ( int a )2 in{ assert( a > 0 ); }3 body { return a − 2; }
check at function exit
..
1 int foo ( int a )2 out{ assert( a > 0 ); }3 body { return a − 2; }
-release flag will not compute contract
..$ ldc2 -release foo.d
. .. 19/122.. . . .. 19/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 38: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/38.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Contract.
......
check a statement..
1 assert( var != null );
check before entering into a function
..
1 double foo ( int a )2 in{ assert( a > 0 ); }3 body { return a − 2; }
check at function exit
..
1 int foo ( int a )2 out{ assert( a > 0 ); }3 body { return a − 2; }
-release flag will not compute contract
..$ ldc2 -release foo.d
. .. 19/122.. . . .. 19/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 39: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/39.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 20/122.. . . .. 20/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 40: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/40.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
System and Safe Code
.System and Safe Code..
......
Safe functions are functions that are statically checkedto have no possibility of undefined behavior.
Undefined behavior is often used as a vector formalicious attacks.
Functions are marked with attributes: @safe,@system, @trusted
. .. 21/122.. . . . .. 21/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 41: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/41.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 22/122.. . . . .. 22/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 42: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/42.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Reference and pointer
.
......
Pointers exist only to create C interface code
..1 int* a = cFunction( param );
ref into function..
1 void foo( ref int[] param ) { …}
ref into a loop
..1 foreach( ref item ; list ){ …}
. .. 23/122.. . . . .. 23/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 43: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/43.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Reference and pointer
.
......
Pointers exist only to create C interface code
..1 int* a = cFunction( param );
ref into function..
1 void foo( ref int[] param ) { …}
ref into a loop
..1 foreach( ref item ; list ){ …}
. .. 23/122.. . . . .. 23/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 44: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/44.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Reference and pointer
.
......
Pointers exist only to create C interface code
..1 int* a = cFunction( param );
ref into function..
1 void foo( ref int[] param ) { …}
ref into a loop
..1 foreach( ref item ; list ){ …}
. .. 23/122.. . . . .. 23/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 45: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/45.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 24/122.. . . . .. 24/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 46: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/46.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
.Generic..
......
class
..1 class Foo( T ){ …}2 Foo!int instance = new Foo!(int)( param );
structure
..1 struct Foo( T ){ …}2 Foo!int instance = Foo!int( param );
function
..1 T foo( T )(T param){ …}2 int var = foo!int( param );
macro
..
1 template TFoo( T )( T param ){ immutable T f = param + 3;}
2 int a = TFoo!int( 4 ) ; // return 7 at compile time
. .. 25/122.. . . . .. 25/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 47: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/47.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
.Generic..
......
class
..1 class Foo( T ){ …}2 Foo!int instance = new Foo!(int)( param );
structure
..1 struct Foo( T ){ …}2 Foo!int instance = Foo!int( param );
function
..1 T foo( T )(T param){ …}2 int var = foo!int( param );
macro
..
1 template TFoo( T )( T param ){ immutable T f = param + 3;}
2 int a = TFoo!int( 4 ) ; // return 7 at compile time
. .. 25/122.. . . . .. 25/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 48: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/48.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
.Generic..
......
class
..1 class Foo( T ){ …}2 Foo!int instance = new Foo!(int)( param );
structure
..1 struct Foo( T ){ …}2 Foo!int instance = Foo!int( param );
function
..1 T foo( T )(T param){ …}2 int var = foo!int( param );
macro
..
1 template TFoo( T )( T param ){ immutable T f = param + 3;}
2 int a = TFoo!int( 4 ) ; // return 7 at compile time
. .. 25/122.. . . . .. 25/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 49: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/49.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
.Generic..
......
class
..1 class Foo( T ){ …}2 Foo!int instance = new Foo!(int)( param );
structure
..1 struct Foo( T ){ …}2 Foo!int instance = Foo!int( param );
function
..1 T foo( T )(T param){ …}2 int var = foo!int( param );
macro
..
1 template TFoo( T )( T param ){ immutable T f = param + 3;}
2 int a = TFoo!int( 4 ) ; // return 7 at compile time
. .. 25/122.. . . . .. 25/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 50: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/50.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 26/122.. . . . . .. 26/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 51: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/51.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Inference
.
......
auto for variable
..1 size_t[] list = [ 0, 1, 2, 3, 4];2 auto item = list[1]; // item type is size_t
auto for function..
1 auto foo( int param ){ …}
. .. 27/122.. . . . . .. 27/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 52: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/52.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Inference
.
......
auto for variable
..1 size_t[] list = [ 0, 1, 2, 3, 4];2 auto item = list[1]; // item type is size_t
auto for function..
1 auto foo( int param ){ …}
. .. 27/122.. . . . . .. 27/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 53: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/53.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 28/122.. . . . . .. 28/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 54: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/54.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Loops.Loops..
......
for loop
..1 for( int i = 0; i < 10; i++ ){ …}
while loop
..1 while( isComputing ){ …}
do while..
1 do{ …}while( isComputing );
foreach loop
..
1 foreach( size_t i; list ){ …}2 foreach( size_t counter, size_t i = 0; list ){ …}3 foreach( counter, i; list ){ …}
. .. 29/122.. . . . . .. 29/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 55: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/55.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 30/122.. . . . . .. 30/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 56: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/56.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Functions
.Functions..
......
classical..
1 void foo( int param ){ …}
with default values..
1 void foo( int param1, int param2 = 3 ){ …}
with variadic parameters
..
1 void foo( int[] params ... ) {2 foreach( param; params )3 …// do something4 }
. .. 31/122.. . . . . . .. 31/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 57: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/57.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Functions
.Functions..
......
classical..
1 void foo( int param ){ …}
with default values..
1 void foo( int param1, int param2 = 3 ){ …}
with variadic parameters
..
1 void foo( int[] params ... ) {2 foreach( param; params )3 …// do something4 }
. .. 31/122.. . . . . . .. 31/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 58: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/58.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Functions
.Functions..
......
classical..
1 void foo( int param ){ …}
with default values..
1 void foo( int param1, int param2 = 3 ){ …}
with variadic parameters
..
1 void foo( int[] params ... ) {2 foreach( param; params )3 …// do something4 }
. .. 31/122.. . . . . . .. 31/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 59: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/59.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 32/122.. . . . . . .. 32/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 60: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/60.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Debugs
.Debugs..
......
debug block
..1 debug( int param ){ …} // ldc2 −d−debug …..
debug line
..1 debug writeln( ”foo” ) ;
unitest
..
1 unitest {2 assert( doFoo( x ), true );3 assert( doBar( x ), 3 );4 …5 }
.
. .. 33/122.. . . . . . .. 33/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 61: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/61.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Debugs
.Debugs..
......
debug block
..1 debug( int param ){ …}
debug line
..1 debug writeln( ”foo” ) ; // ldc2 −d−debug …..
unitest
..
1 unitest {2 assert( doFoo( x ), true );3 assert( doBar( x ), 3 );4 …5 }
.
. .. 34/122.. . . . . . .. 34/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 62: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/62.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Debugs
.Debugs..
......
debug block
..1 debug( int param ){ …}
debug line
..1 debug writeln( ”foo” ) ;
unitest
..
1 unitest { // ldc2 −unittest …..2 assert( doFoo( x ), true );3 assert( doBar( x ), 3 );4 …5 }
.
. .. 35/122.. . . . . . .. 35/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 63: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/63.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 36/122.. . . . . . . .. 36/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 64: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/64.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Versions
.Versions..
......
version conditional code block to use
..
1 version( Windows ){ …}2 else version( linux ){ …}3 else { pragma( msg, ”Unknown operating syystem” ); }
. .. 37/122.. . . . . . . .. 37/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 65: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/65.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Versions
.Versions..
......
own version identifier
..
1 version( FullApp ){ …}2 else version( DemoApp ){ …}3 else { version = DemoApp ); }
from command line give wich version to compile
..
Code 3: Terminal$ ldc2 -d-version="FullApp" myApp.d
. .. 38/122.. . . . . . . .. 38/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 66: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/66.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Versions
.Versions..
......
own version identifier
..
1 version( FullApp ){ …}2 else version( DemoApp ){ …}3 else { version = DemoApp ); }
from command line give wich version to compile
..
Code 4: Terminal$ ldc2 -d-version="FullApp" myApp.d
. .. 38/122.. . . . . . . .. 38/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 67: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/67.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 39/122.. . . . . . . .. 39/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 68: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/68.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Before beginning…
.Tools..
......
Compiler: ldcStandard library: phobosGUI library: gtkd
. .. 40/122.. . . . . . . .. 40/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 69: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/69.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 41/122.. . . . . . . . .. 41/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 70: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/70.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Editors
.Tools..
......
Geany
MonoDevelop with Mono-DEclipse with DDT - D Development ToolsVim + syntasticEmacs + d-mode (GitHub)
. .. 42/122.. . . . . . . . .. 42/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 71: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/71.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Editors
.Tools..
......
GeanyMonoDevelop with Mono-D
Eclipse with DDT - D Development ToolsVim + syntasticEmacs + d-mode (GitHub)
. .. 42/122.. . . . . . . . .. 42/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 72: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/72.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Editors
.Tools..
......
GeanyMonoDevelop with Mono-DEclipse with DDT - D Development Tools
Vim + syntasticEmacs + d-mode (GitHub)
. .. 42/122.. . . . . . . . .. 42/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 73: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/73.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Editors
.Tools..
......
GeanyMonoDevelop with Mono-DEclipse with DDT - D Development ToolsVim + syntastic
Emacs + d-mode (GitHub)
. .. 42/122.. . . . . . . . .. 42/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 74: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/74.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Editors
.Tools..
......
GeanyMonoDevelop with Mono-DEclipse with DDT - D Development ToolsVim + syntasticEmacs + d-mode (GitHub)
. .. 42/122.. . . . . . . . .. 42/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 75: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/75.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Editors.Online tools: D paste..
......
http://dpaste.dzfl.pl/new
. .. 43/122.. . . . . . . . .. 43/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 76: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/76.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Installation
..
Code 5: Terminal# yum install ldc-phobos-devel gtkd-devel
. .. 44/122.. . . . . . . . .. 44/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 77: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/77.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 45/122.. . . . . . . . .. 45/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 78: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/78.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
My first D program
..
Code 6: hello.d1 module hello; ..2 import std.stdio;34 void main () {5 writeln( ”Hello world” );6 }
.
. .. 46/122.. . . . . . . . . .. 46/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 79: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/79.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
My first D program
..
Code 7: hello.d1 module hello;2 import std.stdio; ..34 void main () {5 writeln( ”Hello world” );6 }
.
. .. 47/122.. . . . . . . . . .. 47/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 80: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/80.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
My first D program
..
Code 8: hello.d1 module hello;2 import std.stdio: writeln; ..34 void main () {5 writeln( ”Hello world” );6 }
.
. .. 48/122.. . . . . . . . . .. 48/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 81: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/81.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
My first D program
..
Code 9: hello.d1 module hello;2 import std.stdio: writeln;34 void main () { ..5 writeln( ”Hello world” );6 }
.
. .. 49/122.. . . . . . . . . .. 49/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 82: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/82.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
My first D program
..
Code 10: hello.d1 module hello;2 import std.stdio: writeln;34 void main () {5 writeln( ”Hello world” ); ..6 }
.
. .. 50/122.. . . . . . . . . .. 50/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 83: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/83.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
..
Code 11: Terminal$ ldc2 hello.d$ ./helloHello world
. .. 51/122.. . . . . . . . . . .. 51/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 84: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/84.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 52/122.. . . . . . . . . . .. 52/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 85: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/85.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
TypesType bits Minimum Maximum
void Not available Not available Not availablebyte 8 -128 127short 16 -32768 32767int 32 -2147483648 2147483647long 64 -9223372036854775808 9223372036854775807ubyte 8 0 255ushort 16 0 65535uint 32 0 4294967296ulong 64 0 18446744073709551615float 32 1.18e-38 3.40e+38
double 64 2.23e-308 1.80e+308
ifloat 32 1.18e-38 3.40e+38
idouble 64 2.23e-308 1.80e+308
cfloat 32 1.18e-38 3.40e+38
cdouble 64 2.23e-308 1.80e+308
real 128 3.36e-4932 1.19e+4932
ireal 128 3.36e-4932 1.19e+4932
creal 28 3.36e-4932 1.19e+4932
char utf-8: 8 0 255wchar utf-16: 16 0 65535dchar utf-32: 32 0 4294967293bool 8 false true
. .. 53/122.. . . . . . . . . . .. 53/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 86: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/86.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 54/122.. . . . . . . . . . .. 54/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 87: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/87.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Static arrays
..
1 int[3] a1 = [ 0, 1, 2 ]; ..2 int[3][3] a2 = [ [ 0, 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ];3 a1.length;
.
. .. 55/122.. . . . . . . . . . .. 55/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 88: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/88.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Static arrays
..
1 int[3] a1 = [ 0, 1, 2 ];2 int[3][3] a2 = [ [ 0, 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ]; ..3 a1.length;
.
. .. 56/122.. . . . . . . . . . . .. 56/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 89: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/89.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Static arrays
..
1 int[3] a1 = [ 0, 1, 2 ];2 int[3][3] a2 = [ [ 0, 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ];3 a1.length; // return array size ..
.
. .. 57/122.. . . . . . . . . . . .. 57/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 90: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/90.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Dynamic arrays
..
1 int[] a1 = [ 0, 1, 2 ]; ..2 a1.length;3 a1.length = a1.length + 2;4 a1.length += 2;
.
. .. 58/122.. . . . . . . . . . . .. 58/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 91: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/91.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Dynamic arrays
..
1 int[] a1 = [ 0, 1, 2 ];2 a1.length; // return array size ..3 a1.length = a1.length + 2;4 a1.length += 2;
.
. .. 59/122.. . . . . . . . . . . .. 59/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 92: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/92.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Dynamic arrays
..
1 int[] a1 = [ 0, 1, 2 ];2 a1.length;3 a1.length = a1.length + 2; // resize array ..4 a1.length += 2;
.
. .. 60/122.. . . . . . . . . . . .. 60/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 93: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/93.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Dynamic arrays
..
1 int[] a1 = [ 0, 1, 2 ];2 a1.length;3 a1.length = a1.length + 2;4 a1.length += 2; // not allowed ..
.
. .. 61/122.. . . . . . . . . . . . .. 61/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 94: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/94.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Matrix arrays
..1 int[][] a1 = new int[][](2,5); // [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]2 int [][] a2 = [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ];
. .. 62/122.. . . . . . . . . . . . .. 62/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 95: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/95.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Arrays
..
1 int[] a1 = [ 0, 1, 2 ]; ..2 a1[0];3 a1[0..2];4 a1[0..$];
.
. .. 63/122.. . . . . . . . . . . . .. 63/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 96: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/96.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Arrays
..
1 int[] a1 = [ 0, 1, 2 ];2 a1[0]; // return 0 ..3 a1[0..2];4 a1[0..$];
.
. .. 64/122.. . . . . . . . . . . . .. 64/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 97: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/97.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Arrays
..
1 int[] a1 = [ 0, 1, 2 ];2 a1[0];3 a1[0..2]; // return [0, 1] ..4 a1[0..$];
.
. .. 65/122.. . . . . . . . . . . . .. 65/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 98: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/98.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Arrays
..
1 int[] a1 = [ 0, 1, 2 ];2 a1[0];3 a1[0..2];4 a1[0..$]; // return [0, 1, 2] ..
.
. .. 66/122.. . . . . . . . . . . . . .. 66/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 99: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/99.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Arrays
..
1 int[] a = [ 0, 1, 2 ];2 int[] b = a; // ’b’ point to ’a’ (reference) ..3 int* b_ptr = b.ptr;4 int[] c = a[ 0 .. 2 ];5 int[] d = a[ 0 .. 2 ].dup;
.
. .. 67/122.. . . . . . . . . . . . . .. 67/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 100: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/100.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Arrays
..
1 int[] a = [ 0, 1, 2 ];2 int[] b = a;3 int* b_ptr = b.ptr; // return pointer to given array ..4 int[] c = a[ 0 .. 2 ];5 int[] d = a[ 0 .. 2 ].dup;
.
. .. 68/122.. . . . . . . . . . . . . .. 68/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 101: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/101.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Arrays
..
1 int[] a = [ 0, 1, 2 ];2 int[] b = a;3 int* b_ptr = b.ptr;4 int[] c = a[ 0 .. 2 ]; // is a reference ..5 int[] d = a[ 0 .. 2 ].dup;
.
. .. 69/122.. . . . . . . . . . . . . .. 69/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 102: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/102.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Arrays
..
1 int[] a = [ 0, 1, 2 ];2 int[] b = a;3 int* b_ptr = b.ptr;4 int[] c = a[ 0 .. 2 ];5 int[] d = a[ 0 .. 2 ].dup; // is a copy ..
.
. .. 70/122.. . . . . . . . . . . . . .. 70/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 103: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/103.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Vectors
..
1 int[] a1 = new int[](2); // [0,0]..2 a1[] = 1;3 a1[]+= 2;
.
. .. 71/122.. . . . . . . . . . . . . . .. 71/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 104: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/104.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Vectors
..
1 int[] a1 = new int[](2);2 a1[] = 1; // [1,1]..3 a1[]+= 2;
.
. .. 72/122.. . . . . . . . . . . . . . .. 72/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 105: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/105.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Vectors
..
1 int[] a1 = new int[](2);2 a1[] = 1;3 a1[]+= 2; // [3,3] ..
.
. .. 73/122.. . . . . . . . . . . . . . .. 73/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 106: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/106.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Associative arrays
..
1 int[string] dict; ..2 dict[”D”] = 1;3 ”D” in dict;
.
. .. 74/122.. . . . . . . . . . . . . . .. 74/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 107: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/107.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Associative arrays
..
1 int[string] dict;2 dict[”D”] = 1; ..3 ”D” in dict;
.
. .. 75/122.. . . . . . . . . . . . . . .. 75/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 108: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/108.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Associative arrays
..
1 int[string] dict;2 dict[”D”] = 1;3 ”D” in dict; // true ..
.
. .. 76/122.. . . . . . . . . . . . . . . .. 76/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 109: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/109.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 77/122.. . . . . . . . . . . . . . . .. 77/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 110: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/110.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
String and characters
..
1 string words = ”With double quote, αβγδϵ”; // UTF−82 string words2= words ~ ”, and concatenation”; // concat3 char letter= ’a’; // simple quote
. .. 78/122.. . . . . . . . . . . . . . . .. 78/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 111: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/111.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 79/122.. . . . . . . . . . . . . . . .. 79/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 112: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/112.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Const and Immutable
.Const and Immutable..
......
immutable data: that cannot change.const data: cannot be changedby the current const reference to that data.
. .. 80/122.. . . . . . . . . . . . . . . .. 80/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 113: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/113.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 81/122.. . . . . . . . . . . . . . . . .. 81/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 114: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/114.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Input/Output
..
Code 12: Read a file1 import std.stdio: open, writeln;2 …3 File f = open( ”/path/to/myFile”, ”r” );4 scope(exit) f.close;5 foreach( number, line; f )6 writeln( number, line );7 …
. .. 82/122.. . . . . . . . . . . . . . . . .. 82/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 115: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/115.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Input/Output
..
Code 13: Write a file1 import std.stdio: open, writeln;2 …3 File f = open( ”/path/to/myFile”, ”w” );4 scope(exit) f.close;5 writeln( ”something” );6 …
. .. 83/122.. . . . . . . . . . . . . . . . .. 83/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 116: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/116.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Input/Output
..
Code 14: Capture keyboard1 import std.stdio: open, writeln;2 …3 char[] name;4 size_t age;5 write( ”Enter your name : ” );6 readf( ”%s” ~ newline, &name );7 write( ”How old are you : ” );8 readf( ”%u” ~ newline, &age );9 …
. .. 84/122.. . . . . . . . . . . . . . . . .. 84/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 117: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/117.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 85/122.. . . . . . . . . . . . . . . . .. 85/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 118: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/118.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 15: Searching1 import std.algorihm: count, countUntil, startsWith, endsWith,
canFind;2 …3 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]; ..4 list.count( 1 );5 list.countUntil( 2 );6 list.startsWith( 0 );7 list.endsWith( 9 );8 list.canFind( 2 );
.
. .. 86/122.. . . . . . . . . . . . . . . . . .. 86/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 119: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/119.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 16: Searching1 import std.algorihm: count, countUntil, startsWith, endsWith,
canFind;2 …3 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];4 list.count( 1 ); // result => 2 ..5 list.countUntil( 2 );6 list.startsWith( 0 );7 list.endsWith( 9 );8 list.canFind( 2 );
.
. .. 87/122.. . . . . . . . . . . . . . . . . .. 87/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 120: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/120.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 17: Searching1 import std.algorihm: count, countUntil, startsWith, endsWith,
canFind;2 …3 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];4 list.count( 1 );5 list.countUntil( 2 ); // result => 3 ..6 list.startsWith( 0 );7 list.endsWith( 9 );8 list.canFind( 2 );
.
. .. 88/122.. . . . . . . . . . . . . . . . . .. 88/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 121: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/121.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 18: Searching1 import std.algorihm: count, countUntil, startsWith, endsWith,
canFind;2 …3 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];4 list.count( 1 );5 list.countUntil( 2 );6 list.startsWith( 0 ); // result => true ..7 list.endsWith( 9 );8 list.canFind( 2 );
.
. .. 89/122.. . . . . . . . . . . . . . . . . .. 89/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 122: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/122.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 19: Searching1 import std.algorihm: count, countUntil, startsWith, endsWith,
canFind;2 …3 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];4 list.count( 1 );5 list.countUntil( 2 );6 list.startsWith( 0 );7 list.endsWith( 9 ); // result => true ..8 list.canFind( 2 );
.
. .. 90/122.. . . . . . . . . . . . . . . . . .. 90/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 123: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/123.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 20: Searching1 import std.algorihm: count, countUntil, startsWith, endsWith,
canFind;2 …3 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];4 list.count( 1 );5 list.countUntil( 2 );6 list.startsWith( 0 );7 list.endsWith( 9 );8 list.canFind( 2 ); // result => true ..
.
. .. 91/122.. . . . . . . . . . . . . . . . . . .. 91/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 124: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/124.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 21: Comparison1 import std.algorihm: min, max;2 …3 min( 9, 12); // result => 94 max( 9, 12); // result => 12
. .. 92/122.. . . . . . . . . . . . . . . . . . .. 92/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 125: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/125.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 22: Iteration1 import std.algorihm: filter, uniq, map, reduce;2 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]; ..3 list.filter!( a => a > 6 );4 list.uniq( );5 list.map!( a => a + 2 );6 0.reduce!( (a,b) => a + b )( list );7 list.reduce!( min, max )( );
.
. .. 93/122.. . . . . . . . . . . . . . . . . . .. 93/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 126: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/126.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 23: Iteration1 import std.algorihm: filter, uniq, map, reduce;2 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];3 list.filter!( a => a > 6 ); // result => [ 7, 8, 9 ] ..4 list.uniq( );5 list.map!( a => a + 2 );6 0.reduce!( (a,b) => a + b )( list );7 list.reduce!( min, max )( );
.
. .. 94/122.. . . . . . . . . . . . . . . . . . .. 94/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 127: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/127.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 24: Iteration1 import std.algorihm: filter, uniq, map, reduce;2 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];3 list.filter!( a => a > 6 );4 list.uniq( ); // [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ] ..5 list.map!( a => a + 2 );6 0.reduce!( (a,b) => a + b )( list );7 list.reduce!( min, max )( );
.
. .. 95/122.. . . . . . . . . . . . . . . . . . .. 95/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 128: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/128.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 25: Iteration1 import std.algorihm: filter, uniq, map, reduce;2 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];3 list.filter!( a => a > 6 );4 list.uniq( );5 list.map!( a => a + 2 ); // [ 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11 ] ..6 0.reduce!( (a,b) => a + b )( list );7 list.reduce!( min, max )( );
.
. .. 96/122.. . . . . . . . . . . . . . . . . . . .. 96/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 129: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/129.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 26: Iteration1 import std.algorihm: filter, uniq, map, reduce;2 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];3 list.filter!( a => a > 6 );4 list.uniq( );5 list.map!( a => a + 2 );6 0.reduce!( (a,b) => a + b )( list ); // sum all elements => 49 ..7 list.reduce!( min, max )( );
.
. .. 97/122.. . . . . . . . . . . . . . . . . . . .. 97/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 130: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/130.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 27: Iteration1 import std.algorihm: filter, uniq, map, reduce;2 int[] list = [ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];3 list.filter!( a => a > 6 );4 list.uniq( );5 list.map!( a => a + 2 );6 0.reduce!( (a,b) => a + b )( list );7 list.reduce!( min, max )( ); // compute in one pass min an max ..8 // min: 0 max: 9
.
. .. 98/122.. . . . . . . . . . . . . . . . . . . .. 98/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 131: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/131.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Algorithm
..
Code 28: Sorting1 import std.stdio;2 import std.algorithm;3 import std.array;45 void main( ){6 immutable int[] a = [4, 6, 1, 2];7 immutable int[] b = cast(immutable) a.dup8 .sort!( (x,y) => x < y )9 .array;
10 writeln( b ); // [ 1, 2, 4, 6 ]11 }
. .. 99/122.. . . . . . . . . . . . . . . . . . . .. 99/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 132: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/132.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 100/122.. . . . . . . . . . . . . . . . . . . .. 100/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 133: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/133.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Structure
..
Code 29: Classic implementation1 struct MyStruct{2 int field1;3 float fiel2;4 string field3;5 }
. .. 101/122.. . . . . . . . . . . . . . . . . . . . .. 101/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 134: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/134.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Structure
..
Code 30: With constructor and modifier1 struct MyStruct{2 private:3 int _field1;4 float _fiel2;5 string _field3;67 public:8 this( int f1, float f2, string f3 ){9 _field1 = f1;
10 _field2 = f2;11 _field3 = f3;12 }13 }
. .. 102/122.. . . . . . . . . . . . . . . . . . . . .. 102/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 135: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/135.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Structure
..
Code 31: With method and property1 struct MyStruct{2 private:3 int _field1;4 float _field2;5 string _field3;6 public:7 this( int f1, float f2, string f3 ){8 _field1 = f1;9 _field2 = f2;
10 _field3 = f3;11 }12 this( MyStruct s ){13 _field1 = s.field1;14 _field2 = s.field2;15 _field3 = s.field3;16 }17 @property int field1( ) const { return _field1; }18 @property void field1( int f1 ){ _field1 = f1; }19 @property float field2( ) const { return _field2; }20 @property void field2( float f2 ){ _field2 = f2; }21 @property string field3( ) const { return _field3; }22 @property void field3( string f3 ){ _field3 = f3; }23 MyStruct dup() const{ return MyStruct( this ); }24 }
. .. 103/122.. . . . . . . . . . . . . . . . . . . . .. 103/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 136: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/136.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Class
..
Code 32: Polymorphism1 import std.string: format;23 Interface IPersonnage{4 string name();5 int health();6 int mana();7 }89 class BowMan: IPersonnage{
10 private:11 string _name;12 int _health;13 int _mana;14 public:15 this( string n, int h, int m ){16 _name = n;17 _health = h;18 _mana = m;19 }20 string name() const { return _name; }21 int health() const { return _health; }22 int mana() const { return _mana; }23 override string toString() const{24 return ”name: %s point: %d mana: %d”.format(_name, _health,
_mana);25 }26 }
. .. 104/122.. . . . . . . . . . . . . . . . . . . . .. 104/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 137: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/137.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 105/122.. . . . . . . . . . . . . . . . . . . . .. 105/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 138: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/138.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Template
..
Code 33: Function template1 auto addition(T,U)( T a, U b){2 return a + b;3 }
. .. 106/122.. . . . . . . . . . . . . . . . . . . . . .. 106/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 139: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/139.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Template
..
Code 34: Struct template1 struct TStruct(T) {2 private:3 T _f1;4 public:5 this ( T f1 ){6 _f1 = f1;7 }8 }9 void main(){
10 TStruct!string t1 = TStruct!(string)( ”test” );11 auto t2 = TStruct!int( 5 );12 }
. .. 107/122.. . . . . . . . . . . . . . . . . . . . . .. 107/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 140: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/140.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Template
..
Code 35: Class template1 class TClass(T) {2 private:3 T _f1;4 public:5 this ( T f1 ){6 _f1 = f1;7 }8 }9 auto c1 = new TClass!int( 2 );
. .. 108/122.. . . . . . . . . . . . . . . . . . . . . .. 108/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 141: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/141.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 109/122.. . . . . . . . . . . . . . . . . . . . . .. 109/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 142: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/142.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Miscellanous
..1 int β= 5; // variable name can use UTF−8 char2 int i = 1_000_000; // easy to read number
. .. 110/122.. . . . . . . . . . . . . . . . . . . . . .. 110/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 143: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/143.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Plan.....1 Introduction
ObjectFunctionalMeta-programmingParallelismRessource ManagementContractSystem and Safe CodeReference and pointerGenericsInferenceLoopsFunctionsDebugsVersionsRequirementEditors
...2 BasicsMy first D programTypesArraysString and charactersConst and ImmutableInput/OutputAlgorithmStructure and ClassTemplateMiscellanousLet start it!
...3 GTK D
...4 Thanks To. .. 111/122.. . . . . . . . . . . . . . . . . . . . . . .. 111/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 144: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/144.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
What Are You Waiting For?
.
......
Web site: dlang.org
Community: forum.dlang.orgContribute:www.github.com/D-Programming-Languageirc on freenode #dfrench speaker on jabber [email protected]
. .. 112/122.. . . . . . . . . . . . . . . . . . . . . . .. 112/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 145: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/145.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
What Are You Waiting For?
.
......
Web site: dlang.orgCommunity: forum.dlang.org
Contribute:www.github.com/D-Programming-Languageirc on freenode #dfrench speaker on jabber [email protected]
. .. 112/122.. . . . . . . . . . . . . . . . . . . . . . .. 112/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 146: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/146.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
What Are You Waiting For?
.
......
Web site: dlang.orgCommunity: forum.dlang.orgContribute:www.github.com/D-Programming-Language
irc on freenode #dfrench speaker on jabber [email protected]
. .. 112/122.. . . . . . . . . . . . . . . . . . . . . . .. 112/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 147: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/147.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
What Are You Waiting For?
.
......
Web site: dlang.orgCommunity: forum.dlang.orgContribute:www.github.com/D-Programming-Languageirc on freenode #d
french speaker on jabber [email protected]
. .. 112/122.. . . . . . . . . . . . . . . . . . . . . . .. 112/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 148: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/148.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
What Are You Waiting For?
.
......
Web site: dlang.orgCommunity: forum.dlang.orgContribute:www.github.com/D-Programming-Languageirc on freenode #dfrench speaker on jabber [email protected]
. .. 112/122.. . . . . . . . . . . . . . . . . . . . . . .. 112/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 149: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/149.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
GTK D
..
Code 36: First graphical application1 module myFirstGUI;23 import gtk.MainWindow;4 import gtk.Label;5 import gtk.Main;67 class myFirstGUI: MainWindow{8 this(){9 super(”GtkD”);
10 setBorderWidth(10);11 add(new Label(”Hello World”));12 showAll();13 }14 }1516 void main(string[] args){17 Main.init(args);18 new HelloWorld();19 Main.run();2021 }
. .. 113/122.. . . . . . . . . . . . . . . . . . . . . . .. 113/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 150: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/150.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
GTK D
..
Code 37: Terminal$ ldc2 -L-lgtkd -L-ldl myFirstGUI.d$ ./myFistGUI
. .. 114/122.. . . . . . . . . . . . . . . . . . . . . . .. 114/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 151: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/151.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
GTK D
..
Code 38: First graphical application1 module myFirstGUI;23 import gtk.MainWindow;4 import gtk.Label;5 import gtk.Main;67 pragma(lib, ”gtkd”); ..89 class myFirstGUI: MainWindow{
10 this(){11 super(”GtkD”);12 setBorderWidth(10);13 add(new Label(”Hello World”));14 showAll();15 }16 }1718 void main(string[] args){19 Main.init(args);20 new myFirstGUI();21 Main.run();2223 }
.. .. 115/122.. . . . . . . . . . . . . . . . . . . . . . .. 115/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 152: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/152.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
GTK D
..
Code 39: First graphical application1 module myFirstGUI;23 import gtk.MainWindow;4 import gtk.Label;5 import gtk.Main;67 pragma(lib, ”gtkd”);89 class myFirstGUI: MainWindow{ ..
10 this(){11 super(”GtkD”);12 setBorderWidth(10);13 add(new Label(”Hello World”));14 showAll();15 }16 }1718 void main(string[] args){19 Main.init(args);20 new myFirstGUI();21 Main.run();2223 }
.. .. 116/122.. . . . . . . . . . . . . . . . . . . . . . . .. 116/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 153: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/153.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
GTK D
..
Code 40: First graphical application1 module myFirstGUI;23 import gtk.MainWindow;4 import gtk.Label;5 import gtk.Main;67 pragma(lib, ”gtkd”);89 class myFirstGUI: MainWindow{
10 this(){11 super(”GtkD”);12 setBorderWidth(10);13 add(new Label(”Hello World”));14 showAll();15 }16 }1718 void main(string[] args){ ..19 Main.init(args);20 new myFirstGUI();21 Main.run();2223 }
.. .. 117/122.. . . . . . . . . . . . . . . . . . . . . . . .. 117/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 154: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/154.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
First graphical Application
..
Code 41: Terminal$ ldc2 -L-ldl myFirstGUI.d$ ./myFistGUI
. .. 118/122.. . . . . . . . . . . . . . . . . . . . . . . .. 118/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 155: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/155.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
GTK D
..
Code 42: First graphical application1 module myFirstGUI;23 import gtk.MainWindow;4 import gtk.Label;5 import gtk.Main;67 pragma(lib, ”gtkd”);8 version( Linux ) pragma(lib, ”dl”); ..9
10 class myFirstGUI: MainWindow{11 this(){12 super(”GtkD”);13 setBorderWidth(10);14 add(new Label(”Hello World”));15 showAll();16 }17 }1819 void main(string[] args){20 Main.init(args);21 new myFirstGUI();22 Main.run();2324 }
.. .. 119/122.. . . . . . . . . . . . . . . . . . . . . . . .. 119/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 156: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/156.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
First graphical Application
..
Code 43: Terminal$ ldc2 myFirstGUI.d$ ./myFistGUI
. .. 120/122.. . . . . . . . . . . . . . . . . . . . . . . .. 120/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 157: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/157.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Contact
.Comments, suggestions or bug reports ?..
......Please send a mail at:[email protected]
. .. 121/122.. . . . . . . . . . . . . . . . . . . . . . . . .. 121/122.
D Programming .
.
.. . . Forward.
.
. ... Back
![Page 158: Fudcon D programming](https://reader034.fdocuments.us/reader034/viewer/2022052622/559752701a28abec5b8b461f/html5/thumbnails/158.jpg)
D Programming
Jonathan MERCIER
IntroductionObject
Functional
Meta-programming
Parallelism
Ressource Management
Contract
System and Safe Code
Reference and pointer
Generics
Inference
Loops
Functions
Debugs
Versions
Requirement
Editors
BasicsMy first D program
Types
Arrays
String and characters
Const and Immutable
Input/Output
Algorithm
Structure and Class
Template
Miscellanous
Let start it!
GTK D
Thanks To
Thanks to.
......
To your attentionFrench fedora communityD communityMohamed El Morabity
. .. 122/122.. . . . . . . . . . . . . . . . . . . . . . . . .. 122/122.
D Programming .
.
. ... Back