16. Isolate の StartUp
main が終わったら、
MessageHandler で
EventLoop
Task が
Thread を生成
1 個だけ
dart main から
起動
Isolate
Message
HandlerTask
Message
Handler
Thread
thread
pool
async task が
残っている限り
仕事し続ける。
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)
18. EventLoop And Zone
Zone は RootZone から parent が fork して
木構造でつながる。
zone
scheduleMicrotask で順次実行
Zone の木構造に応じて 1thread で順番に実行
zone
current_zone
zone
zone
21. 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'.
22. Dart Generics
Class の Reified Generics のみ ( 型パラメータを保存する領域あり )
Generics を使用した場合のみ、 Class のインスタンスを new する際に、
型パラメータを保存する命令を挿入する。
TypeArguments っていう IR が存在する。
Method generics は存在しない。
型パラメータを参照するのは、 checked mode のみ。
Generics の型パラメータも validation のみ。