2004年01月14日
2004年01月14日
X-Day: 3
DMD0.78 なんかバグフィックスっぽいが。受験終わるごろにはうはうはになってくれないかなぁ。 D言語系のアンテナに引っかかってるっぽいけど何もなくてすんません。東北大なコード置いてもいんだけどもろもろの配布条件がよくわかんね… てめー勉強してんのか、といわれると、
Squeak入門とかいう本を読みふけっている。 センター足切りくらったらアニメイトに就職して、750点こしたら1/31に名塚イベントいきまふ。
最近の情勢
yaneBBSで
C#2.0を発見。Genericsについてだらだら書いてあるけど読んでる暇ねぇ 19.1.3によると
19.1.3 Generic type instantiations Similar to a non-generic type, the compiled representation of a generic type is intermediate language (IL) instructions and metadata. The representation of the generic type of course also encodes the existence and use of type parameters. The first time an application creates an instance of a constructed generic type, such as Stack<int>, the just-in-time (JIT) compiler of the .NET Common Language Runtime converts the generic IL and metadata to native code, substituting actual types for type parameters in the process. Subsequent references to that constructed generic type then use the same native code. The process of creating a specific constructed type from a generic type is known as a generic type instantiation. The .NET Common Language Runtime creates a specialized copy of the native code for each generic type instantiation with a value type, but shares a single copy of the native code for all reference types (since, at the native code level, references are just pointers with the same representation).
C++とかはtemplateは完全に展開されてコンパイルされてコードが生成するが、.NETコードのバイナリであるMSILのコードの中にはGenericな情報が残されたままコードになっていて、.NETコードを起動したときに呼び出されるジャストインタイムコンパイラ(JIT)が必要におうじてクラスコードを実体化させる、と。さらにリファレンスタイプ(class型)がテンプレートパラメータの奴は全部同じコードが流用されると。リファレンスタイプでない型はintとかの組み込みとstructとかだけだけど、コンテナとして使う分にはほとんどリファレンスタイプか数少ない組み込み型だろうしなんか妥当な気がする。 まあ多重継承のかわりにポリシークラスぅ〜とか心で叫びつつひたすらブラケットを書き並べるコードをかいてると、実行遅くて死ぬと。いうことか。 JavaGenericsはVM変更なしな条件のもと拡張されたGenericsで、コンパイル時に静的に型情報が展開され、Genericsな情報は失われる。このC++的方法の方が.NETな方法より実行効率はいんだが、Javaの場合今更そんなの気にするもんでもなく、互換性って面だけの話なんだろな。
かこいいスギルIntelliSenseこういうのをみせられると、やっぱりVisualStudioってすげー
Generics in MSILによるといくつかILに追加された(修正された)命令がある模様。
New IL Instructions - class myclass<T1,…,Tn> - value class mystruct<T1,…,Tn> - !n (class type variable) - !!n (method type variable) - ldelem.any, stelem.any (ldelem.i4) - call, callvirt, ldfld, stfld, newobj, newarr (modified for instantiation specifications) - castclass, isinst (modified for exact runtime type semantics)
この分野熱いな。ただコンテナ使うのが主な目的っぽくって、アレゲな機能は実装されてんのかなぁ。暗黙に引数の型から実体化してくれる(?)奴とか。D言語が一番ちかそーなきがするからがんばってほしいなぁ。 そんなことより2Bを確率Basicで乗り切る訓練をしないとなぁ…去年の難易度維持つーうわさをちらほら。そもそも俺の中でBasicって、掛け算って足し算よりさきに計算してくれるっけ?って程度になってる今日この頃。