SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
むかーしむかし… 
• いつものように、川でILしていると… 
J
「J」の付く桃から… 
J 
インターフェイス 
スタティックメソッド!! 
?!?!
抽象太郎 
ものがたり 
そして伝説へ… 
2014.12.06 Center CLR / Kouji Matsui 
NGK2014B
自己紹介 
•けきょ(@kekyo2) 
•Center CLRオーガナイザー 
•会社やってます。フレームワークとかアーキ。 
•認定スクラムマスター。 
•自転車乗ってます。 
•去年は、「山椒」がどうとかいうネタ。
「J」の付く言語では… 
•はるか遠い昔、伝説によれば、「J」の付く言語ではイン ターフェイスにスタティックメソッドが定義できたと言う。 
•C#では、インターフェイスは純粋抽象なので、定数や実 装を持つ事は出来ない。 
C#はそうかもね
ILならどうかな?!
Emitでスタティックメソッドを定義
Emitでプロパティを定義
Emitでインターフェイスに実装 
GitHub見て
使ってみる、C#で。 
ダメ ぽよ
リフレクションで動的にならおk
つまらん… 
• IL・CLR的に許されているのは、やや興味深い。だが、 
我々が探しているのはこのようなチープな代物ではない… 
そ、そうだ、そもそも伝説は 
J から始まったのだった!?
「J」の伝説を再調査 
•驚愕の事実、「J」においても、インターフェイスに スタティックメソッドは実装できない(気のせいだったorz) 
た、確かめなければ アァァァァッッ!! 
「J」において許されるのは、 
定数とインナークラス 
の定義のみであった!?!
これはもう、 
「伝説級のアレ」 
しかなかろう…
オーパーツの発掘
J#、初体験
やはり、駄目なのか?… 
プロパティだと思ってる
をををを!!! 
こいつ、 
動くぞ!?
と、言う事は… 
•Emitしたインターフェイスでもおk!!!
まとめ 
•IL・CLRのレベルでは、インターフェイスに定数・スタ ティックメソッド・プロパティ・インナークラスを持つ事 が可能。 
•C#のコンパイラは、インナークラス以外は認識不能。 IntelliSenseは認識しているのが惜しい… Roslynでは統一 されるか?(多分、駄目な方向に) 
•C#のインターフェイスは、多分COMのインターフェイス が基礎にあると思います(インターフェイスは純粋抽象で なければならない) 
•インナークラスへのアクセスが除外されていないのは、 C#コンパイラのバグ?かも…
で? 
•何の役に立つんだ? 
•伝説が判明した。って事でw 忘年会だしね!
めでたしめでたし。 
•来年もCenter CLRをよろしくお願いします(´Д`) 
•GitHub https://github.com/kekyo/CenterCLR.StaticMethodInInterface.git 
•ブログ http://www.kekyo.net/ 
•Center CLR公式サイト(Facebook) http://centerclr.net/

Más contenido relacionado

Mehr von Kouji Matsui

パターンでわかる! .NET Coreの非同期処理
パターンでわかる! .NET Coreの非同期処理パターンでわかる! .NET Coreの非同期処理
パターンでわかる! .NET Coreの非同期処理Kouji Matsui
 
Making archive IL2C #6-55 dotnet600 2018
Making archive IL2C #6-55 dotnet600 2018Making archive IL2C #6-55 dotnet600 2018
Making archive IL2C #6-55 dotnet600 2018Kouji Matsui
 
Matrix signal controller and BrainPad overview
Matrix signal controller and BrainPad overviewMatrix signal controller and BrainPad overview
Matrix signal controller and BrainPad overviewKouji Matsui
 
What's Functional?
What's Functional?What's Functional?
What's Functional?Kouji Matsui
 
Pitfall for WioLTE
Pitfall for WioLTEPitfall for WioLTE
Pitfall for WioLTEKouji Matsui
 
How to make the calculator
How to make the calculatorHow to make the calculator
How to make the calculatorKouji Matsui
 
Write common, run anywhere
Write common, run anywhereWrite common, run anywhere
Write common, run anywhereKouji Matsui
 
Locality of Reference
Locality of ReferenceLocality of Reference
Locality of ReferenceKouji Matsui
 
C#でわかる こわくないMonad
C#でわかる こわくないMonadC#でわかる こわくないMonad
C#でわかる こわくないMonadKouji Matsui
 
You will be assimilated. Resistance is futile.
You will be assimilated. Resistance is futile.You will be assimilated. Resistance is futile.
You will be assimilated. Resistance is futile.Kouji Matsui
 
How to meets Async and Task
How to meets Async and TaskHow to meets Async and Task
How to meets Async and TaskKouji Matsui
 
Beachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JITBeachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JITKouji Matsui
 
Async deepdive before de:code
Async deepdive before de:codeAsync deepdive before de:code
Async deepdive before de:codeKouji Matsui
 
Thread affinity and CPS
Thread affinity and CPSThread affinity and CPS
Thread affinity and CPSKouji Matsui
 
Async DeepDive basics
Async DeepDive basicsAsync DeepDive basics
Async DeepDive basicsKouji Matsui
 
continuatioN Linking
continuatioN LinkingcontinuatioN Linking
continuatioN LinkingKouji Matsui
 
.NET Coreから概観する.NETのOSSへの取り組み
.NET Coreから概観する.NETのOSSへの取り組み.NET Coreから概観する.NETのOSSへの取り組み
.NET Coreから概観する.NETのOSSへの取り組みKouji Matsui
 
Win32 APIをてなずけよう
Win32 APIをてなずけようWin32 APIをてなずけよう
Win32 APIをてなずけようKouji Matsui
 
不健康なIt戦士を健康的にするアレの話
不健康なIt戦士を健康的にするアレの話不健康なIt戦士を健康的にするアレの話
不健康なIt戦士を健康的にするアレの話Kouji Matsui
 

Mehr von Kouji Matsui (20)

パターンでわかる! .NET Coreの非同期処理
パターンでわかる! .NET Coreの非同期処理パターンでわかる! .NET Coreの非同期処理
パターンでわかる! .NET Coreの非同期処理
 
Making archive IL2C #6-55 dotnet600 2018
Making archive IL2C #6-55 dotnet600 2018Making archive IL2C #6-55 dotnet600 2018
Making archive IL2C #6-55 dotnet600 2018
 
Matrix signal controller and BrainPad overview
Matrix signal controller and BrainPad overviewMatrix signal controller and BrainPad overview
Matrix signal controller and BrainPad overview
 
Fun with BrainPad
Fun with BrainPadFun with BrainPad
Fun with BrainPad
 
What's Functional?
What's Functional?What's Functional?
What's Functional?
 
Pitfall for WioLTE
Pitfall for WioLTEPitfall for WioLTE
Pitfall for WioLTE
 
How to make the calculator
How to make the calculatorHow to make the calculator
How to make the calculator
 
Write common, run anywhere
Write common, run anywhereWrite common, run anywhere
Write common, run anywhere
 
Locality of Reference
Locality of ReferenceLocality of Reference
Locality of Reference
 
C#でわかる こわくないMonad
C#でわかる こわくないMonadC#でわかる こわくないMonad
C#でわかる こわくないMonad
 
You will be assimilated. Resistance is futile.
You will be assimilated. Resistance is futile.You will be assimilated. Resistance is futile.
You will be assimilated. Resistance is futile.
 
How to meets Async and Task
How to meets Async and TaskHow to meets Async and Task
How to meets Async and Task
 
Beachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JITBeachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JIT
 
Async deepdive before de:code
Async deepdive before de:codeAsync deepdive before de:code
Async deepdive before de:code
 
Thread affinity and CPS
Thread affinity and CPSThread affinity and CPS
Thread affinity and CPS
 
Async DeepDive basics
Async DeepDive basicsAsync DeepDive basics
Async DeepDive basics
 
continuatioN Linking
continuatioN LinkingcontinuatioN Linking
continuatioN Linking
 
.NET Coreから概観する.NETのOSSへの取り組み
.NET Coreから概観する.NETのOSSへの取り組み.NET Coreから概観する.NETのOSSへの取り組み
.NET Coreから概観する.NETのOSSへの取り組み
 
Win32 APIをてなずけよう
Win32 APIをてなずけようWin32 APIをてなずけよう
Win32 APIをてなずけよう
 
不健康なIt戦士を健康的にするアレの話
不健康なIt戦士を健康的にするアレの話不健康なIt戦士を健康的にするアレの話
不健康なIt戦士を健康的にするアレの話
 

抽象太郎ものがたり そして伝説へ