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

2,792 views
2,610 views

Published on

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

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,792
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
7
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • 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

    ×