diff options
author | NickPapanastasiou <nickpap9411@gmail.com> | 2015-06-16 17:15:14 -0400 |
---|---|---|
committer | NickPapanastasiou <nickpap9411@gmail.com> | 2015-06-16 17:15:14 -0400 |
commit | c04bb1a39c0a6feacbff5aaf950a33f8d29f6d79 (patch) | |
tree | acad53747ee4e64b3bcd8525fa5d0c9f057b0594 /d.html.markdown | |
parent | b0859afe7fd0981f676598c95e54a73677710215 (diff) |
formatting
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. |