Comment detail
コマンドライン引数の取得 (Nested Flatten)GNU Smalltalk。Cのgetoptっぽい機能が付いてます。
1 2 3 4 5 6 | Smalltalk arguments print.
Smalltalk arguments: '-c -d:' do: [:o :n| {o. n} print ]!
"
$ gst 114.st -a a b -c -dFuga
=> ('a' 'b' '-c' '-dFuga' )(nil 'a' )(nil 'b' )($c nil )($d 'Fuga' )
"
|




sumim
#5013()
[
Smalltalk
]
Rating2/2=1.00
Smalltalk では処理系依存です。Squeak Smalltalk では、 起動時に
Squeak my.image program.st a b c d
のように記述し、スクリプト中では SmalltalkImage>>#getSystemAttribute: の引数 3 以降で取り出せます。
see: Squeak Swiki - Writing scripts
| args | World findATranscript: nil. args := (3 to: 6) collect: [:idx | SmalltalkImage current getSystemAttribute: idx]. Transcript cr; show: args "=> #('a' 'b' 'c' 'd') "Rating2/2=1.00-0+
1 reply [ reply ]