22. Isolate の StartUp(2)
main が終わったら、
MessageHandler で
EventLoop
Main script
async task が
残っている限り
仕事し続ける。
Isolate
Message
HandlerTask
Message
Handler
Thread
Message
Receive
port_map
Unhandled exception:
type 'double' is not a subtype of type 'int' of 'num'.
#0
func (file:///syntax/lib/diff/future.dart:28:13)
#1
main (file:///syntax/lib/diff/future.dart:33:7)
#2
_startIsolate.isolateStartHandler (dart:isolate-patch/isolate_patch.dart:216)
#3
_RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:115)
28. Dart Optional Typing
Dart の型の違反は、基本的に warning 扱い
何が error で何が warning かは、他の言語と比較すると結構曖昧かも。
Breaking on exception:
type 'double' is not a subtype of type 'int' of 'num'.
int sum = 100 + 100.0;
int num = 100.0;
IDE/ コンパイル時に warning と分かるし、
binaryoperator(+) の 2 引数の validation 命令を
JIT コンパイル時に挿入する。
実行時に validation されて warning
こちらは = の assign に validation 版の命令を
JIT コンパイル時に挿入する。
実行時に validation されて warning
Breaking on exception:
type 'double' is not a subtype of type 'int' of 'num'.
29. Dart Generics
Class の Reified Generics のみ ( 型パラメータを保存する領域あり )
Generics を使用した場合のみ、 Class のインスタンスを new する際に、
型パラメータを保存する命令を挿入する。
TypeArguments っていう IR が存在する。
型パラメータは、実行時にいつでも参照できる。
Method generics は存在しない。
型パラメータを参照するのは、 checked mode のみ。
Generics の型パラメータも validation される。
30. Dartium
dartium
標準化された API を
IDL から自動生成
dartium 連携用
native
symbol
Web IDL
Auto-generated library
sdk/lib/html
dart runtime
sdk/lib
dartium で定義された
シンボルを Native Extensions
を使用して直接呼出て連携する。
runtime/
include
dartium からの制御は
include で定義された
API 経由で
dart runtime に指示