erl のオプション -run と -s の違い
erl のオプション -run と -s の違いが解りにくい。
http://www.erlang.org/doc/man/erl.html
にあるドキュメントを読むと
-run Mod [Func [Arg1, Arg2, ...]] (init flag)
Makes init call the specified function. Func defaults to start. If no arguments are provided, the function is assumed to be of arity 0. Otherwise it is assumed to be of arity 1, taking the list [Arg1,Arg2,...] as argument. All arguments are passed as strings. See init(3).
-s Mod [Func [Arg1, Arg2, ...]] (init flag)
Makes init call the specified function. Func defaults to start. If no arguments are provided, the function is assumed to be of arity 0. Otherwise it is assumed to be of arity 1, taking the list [Arg1,Arg2,...] as argument. All arguments are passed as atoms. See init(3).
なんだこの間違い探し。酔っぱらっているので凝視しないと違いが解らなかった。
つまりは、-run は引数が文字列(list) の list の状態で渡されるが、-s は atom の list で渡されるとのこと。
どっちでもいいやって一瞬思ったけどよく考えると -s はオススメ出来ないな。
理由は2つ、erlang の atom には使用できる数に制限があること、もう一つは erlang:list_to_integer/1 はあるけど、 erlang:atom_to_integer/1 は無いこと。
Permanent Link: http://www.cuspy.org/blog/archives/535
Trackback URL: http://www.cuspy.org/blog/archives/535/trackback