Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
D

    Thu, September 22, 2009
• tama : repeatedly
•         T

  •
•                         (     )

•                     D       ...
•

•D
D
• Digital Mars   Walter

  •                       M$

•
  •                            (

•
•   DMD         •   GDC

    •               •   GCC


•   D.NET           •          → LDC

    •           •   LDC

•   ...
DMD

•
• 1-2
  •
•       1   2   3
1
    2
•
•
    • arr + 10
•
    • Ruby       arr[1..7]
const / immutable
• const
  • const
• immutable
  •
•             (   )
• pure
• nothrow
• ref int foo() { ...; return *p; }
  ref

    foo = 3;
•
•
• op*
• override
• alias this (       )
class Foo
{
                         Foo foo;
   Bar bar;
                        ...
Template
• C++
 •              !() → Foo!(int)(args);

 • C++            +α

   • template
• Mixin
Template
•
    template Foo(T)
    {
      class Foo { }
      void foo() { }
    }
•
    template Foo(T)
    {
      clas...
Mixin
•              •   Template


    •   D          •   Ruby mixin


                   •


    TMP
               mixin
TMP
•                             •
    •   static if                 •
    •   is
                                  •
   ...
static if
•          if
is
•
concept if
• template
•                TLS

• shared
  • shared
•                      __gshared

• synchronized
•       enum

    •
• final switch
 •
 •
enum
enum Foo : string { A = “a”, B = “b”, C = “c” }

final switch (foo) {
case Foo.A, Foo.B: ... break;
case Foo.C: ... br...
• Eiffel
•        in/out   invariant

•
  • release
void func(int v)   int func()      class Foo
in                 out(r)          {
{                  {                  in...
• unittest {}
•
  int foo() { return 0; }
  unittest
  {
     assert(foo == 0);
  }
GC

•
•             GC

    •   GC   ML

•             GC
DIP
• D improve proposal
  •
  •
    •
•
•
•
•
•
• etc...
•              2

    • Andrei         ML

    •
•3
  •
•                  Noop   C#   (ry
Phobos
std.range
• Range
 • Phobos
   • R.I.P opApply
 • Iterators must go
• Range
 •                      etc...
range
• Recurrence
auto fib = recurrence!("a[n-1] + a[n-2]")(1, 1);
foreach (e; take(10, fib)) { writeln(e); }
• random
int[...
std.contract
• enforce
  auto file = fopen(“hoge.d”)
  if (file is null)
      throw new Exception;


  auto file = enforce(f...
std.regex
•                std.regexp

• PCRE              ECMA standard
auto r = regex("ab");
foreach(m; match("abcabcaba...
• std.algorithm
 • STL
• std.variant
 • Variant
• std.traits
 • TMP          template
• Andrei
 • Boost::Optional
 • net
 •                     replace

• Tango            …
Appendix
• D official site
 •
• The Case for D
 •
• C/C++            D   2.0
D言語をたまには真面目に紹介してみる
Upcoming SlideShare
Loading in …5
×

D言語をたまには真面目に紹介してみる

3,057 views

Published on

Aizu.LT 03のロングトークで喋ったスライド

Published in: Technology
  • Be the first to comment

D言語をたまには真面目に紹介してみる

  1. 1. D Thu, September 22, 2009
  2. 2. • tama : repeatedly • T • • ( ) • D ...
  3. 3. • •D
  4. 4. D • Digital Mars Walter • M$ • • ( •
  5. 5. • DMD • GDC • • GCC • D.NET • → LDC • • LDC • DLI • LLVM • … • GDC
  6. 6. DMD • • 1-2 • • 1 2 3
  7. 7. 1 2
  8. 8. • • • arr + 10 • • Ruby arr[1..7]
  9. 9. const / immutable • const • const • immutable • • ( )
  10. 10. • pure • nothrow • ref int foo() { ...; return *p; } ref foo = 3; • •
  11. 11. • op* • override • alias this ( ) class Foo { Foo foo; Bar bar; foo.func; // bar.func call alias bar this; }
  12. 12. Template • C++ • !() → Foo!(int)(args); • C++ +α • template • Mixin
  13. 13. Template • template Foo(T) { class Foo { } void foo() { } } • template Foo(T) { class Foo { } class Foo(T) { } }
  14. 14. Mixin • • Template • D • Ruby mixin • TMP mixin
  15. 15. TMP • • • static if • • is • • concept if • • • etc... • alias etc...
  16. 16. static if • if
  17. 17. is •
  18. 18. concept if • template
  19. 19. • TLS • shared • shared • __gshared • synchronized
  20. 20. • enum • • final switch • •
  21. 21. enum enum Foo : string { A = “a”, B = “b”, C = “c” } final switch (foo) { case Foo.A, Foo.B: ... break; case Foo.C: ... break; // break // default: }
  22. 22. • Eiffel • in/out invariant • • release
  23. 23. void func(int v) int func() class Foo in out(r) { { { int v; assert(v); assert(r); } } invariant() body body { { { assert(v); ... return 0; } } } }
  24. 24. • unittest {} • int foo() { return 0; } unittest { assert(foo == 0); }
  25. 25. GC • • GC • GC ML • GC
  26. 26. DIP • D improve proposal • • • •
  27. 27. • • • • • etc...
  28. 28. • 2 • Andrei ML • •3 • • Noop C# (ry
  29. 29. Phobos
  30. 30. std.range • Range • Phobos • R.I.P opApply • Iterators must go • Range • etc...
  31. 31. range • Recurrence auto fib = recurrence!("a[n-1] + a[n-2]")(1, 1); foreach (e; take(10, fib)) { writeln(e); } • random int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ]; auto rnd = Random(unpredictableSeed); foreach (e; randomCover(a, rnd)) { writeln(e); }
  32. 32. std.contract • enforce auto file = fopen(“hoge.d”) if (file is null) throw new Exception; auto file = enforce(fopen(“hoge.d”)) // null
  33. 33. std.regex • std.regexp • PCRE ECMA standard auto r = regex("ab"); foreach(m; match("abcabcabab", r)) { writefln("%s[%s]%s", m.pre, m.hit, m.post); }
  34. 34. • std.algorithm • STL • std.variant • Variant • std.traits • TMP template
  35. 35. • Andrei • Boost::Optional • net • replace • Tango …
  36. 36. Appendix • D official site • • The Case for D • • C/C++ D 2.0

×