diff options
Diffstat (limited to 'd.html.markdown')
-rw-r--r-- | d.html.markdown | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/d.html.markdown b/d.html.markdown index ee06a425..39c6a4d3 100644 --- a/d.html.markdown +++ b/d.html.markdown @@ -16,6 +16,7 @@ import std.stdio; void main(string[] args) { writeln("Hello, World!"); } +``` If you're like me and spend way too much time on the internet, odds are you've heard about [D](http://dlang.org/). The D programming language is a modern, general-purpose, @@ -133,6 +134,13 @@ getter and setter methods (`object.setX(7)`)! ```d // Consider a class parameterized on a types T, U + +class MyClass(T, U) { + T _data; + U _other; + +} + // And "getter" and "setter" methods like so class MyClass(T, U) { T _data; @@ -212,6 +220,6 @@ Notice how we got to build a nice Haskellian pipeline to compute num? That's thanks to a D innovation know as Uniform Function Call Syntax. With UFCS, we can choose whether to write a function call as a method or free function call! Walter wrote a nice article on this [http://www.drdobbs.com/cpp/uniform-function-call-syntax/232700394](here.) In short, you can call functions whose first parameter -is of some type A on any expression of type A as a methods. +is of some type A on any expression of type A as a method. |