6

Is there a way to use records directly in erl? No matter what I try, it always says it canno find the record. I am trying to do mnesia transactions and I cannot go too far without my records. Any help is greatly appreciated - thank you!

4

2 に答える 2

14

はい、help() を使用して、シェルでこれらのコマンドを見つけてください。

rd(R,D)    -- define a record
rf()       -- remove all record information
rf(R)      -- remove record information about R
rl()       -- display all record information
rl(R)      -- display record information about R
rp(Term)   -- display Term using the shell's record information
rr(File)   -- read record information from File (wildcards allowed)
rr(F,R)    -- read selected record information from file(s)
rr(F,R,O)  -- read selected record information with options

これらはシェルの巧妙なハックであり、コンパイル時にモジュールで使用されるレコード定義をロードできます。rr コマンドを使用してモジュールからロードします。

これらは対話型シェルでのみ使用できることに注意してください。

于 2009-09-06T17:45:52.237 に答える
4

どういう意味ですか?シェルでは、クリスチャンが書いたとおりです。モジュールの場合は、使用する前にレコードを定義する必要があります。これを行う方法の説明については、http: //erlang.org/doc/ にあるオンラインの erlang ドキュメントを参照してください。それらはコンパイル時の構造にすぎないため、そのままでは存在しません。

于 2009-09-07T00:03:13.783 に答える