D vs OWKN Language at LLnagoya

Post on 25-May-2015

1.250 views 0 download

Tags:

description

Nagoya Kowai!

Transcript of D vs OWKN Language at LLnagoya

D言語 vs C pLus pLus2011/11/5

LL名古屋 #llnagoya

お前誰よ• @repeatedlly

• Come from Tokyo!

• I can write D Programming Language

• カンスウガタゲンゴガスキデス

• Please give me native F# compiler!

• Twitter monitored by Ganglia

history

普通

http://www35.atwiki.jp/futsuu/pages/1.html

http://jubat.us/

Fluent

http://atnd.org/events/21711

D言語 vs C++

vsにすらならない…

買って下さい

Red BuLL

One more thing...

D is LL

rdmd --eval='writeln("hoge");'

dmd 2.056!

Broken trunk in Mac!

GDC into GCC!

strong point!

short name :)

semi-colonless

struct RedBull{ int countPerDay = 2;} // ← Cool!

Goodbye arrow!

void f(Foo* foo){ foo.func(0);}

すいろん!

C++ 11const auto num = foo.func();

too long...

すいろん!

Dconst num = foo.func();

Many signatures!

@safe @property pure nothrowintout(int)[] func(inout(int)[] arg) const;

すいろん!

{}

void delegate() pure nothrow @safe

すいろん!MinType!(T1, T2, T) min(T1, T2, T...)(T1 a, T2 b, T xs)

@safe int f(int a, int b) pure nothrow{ return min(a, b);}

pure nothrow @safe int(int a, int b, () xs)

*

int[] foo(int[] a, int x) {}

const(int)[] foo(const(int)[] a, int x) {}

immutable(int)[] foo(immutable(int)[] a, int x) {}

inout(int)[] foo(inout(int)[] a, int x) {}

CTFE

array

associative array

struct

if

for

foreach

new(without class)

function template

regex

普通に書く

疑似乱数ulong gen(){ Random r; popFrontN(r, 1000); return r.front;}

正規表現 (仮)

string hogeMatch(string line){ enum re = ctRegex(“hoge”); const matched = match(line, re); return matched.hit;}

try - catch - finally!static assert({ int n; try { n = 2; } catch (Exception e) {} finally { n = 3; }}());

Class in CTFE

https://github.com/donc/dmd/tree/ctfeclass

We will use CT Exception :)

僕と契約して(ry

Boost.Contractとか(ry

class C{ invariant() {} int func(int a) in { assert(a > 10); }

out(r) { assert(r > a * 2); } body { /* */ }}

Orbit Package Manager

https://github.com/jacob-carlborg/orbit

Orbit Spec example

name "orbit"summary "Orbit is a package manager"version "0.0.1"files Dir["**/*.{d,rb,conf}"]executables %w[orb]bindir "bin"build "dsss"

Ruby like :)

No, it’s Ruby!

Walter is weak in D

Wishlist

• Compiler as a Library

• Thread Local GC

• Truly IO module

• STM

• Light-weight Thread (me!)

• Concurrent Revisions (me!)

HaskeLL

買って下さい

Nagoya kowai!