2017-12-16 13 views
3

単一のモジュールに複数の-export()ステートメントがあることがあるのはなぜですか?Erlang - 単一のモジュールに複数の-export()ステートメントがあることがある理由

例:他の言語と同様に

-module(ejabberd_config). 
-author('[email protected]'). 

-export([start/0, load_file/1, reload_file/0, read_file/1, 
    get_option/1, get_option/2, add_option/2, has_option/1, 
    get_vh_by_auth_method/1, 
    get_version/0, get_myhosts/0, get_mylang/0, get_lang/1, 
    get_ejabberd_config_path/0, is_using_elixir_config/0, 
    prepare_opt_val/4, transform_options/1, collect_options/1, 
    convert_to_yaml/1, convert_to_yaml/2, v_db/2, 
    env_binary_to_list/2, opt_type/1, may_hide_data/1, 
    is_elixir_enabled/0, v_dbs/1, v_dbs_mods/1, 
    default_db/1, default_db/2, default_ram_db/1, default_ram_db/2, 
    default_queue_type/1, queue_dir/0, fsm_limit_opts/1, 
    use_cache/1, cache_size/1, cache_missed/1, cache_life_time/1]). 

-export([start/2]). 
+0

それは問題ではありません、複数のエクスポート・ステートメントを使用すると、ちょうど良いです読み取りのために – beiping96

答えて

4

、マルチ輸出は例えばとして、コードを読むのに役立ちます:

%% Creation, inspection and conversion 
-export([new/0,is_queue/1,is_empty/1,len/1,to_list/1,from_list/1,member/2]). 
%% Original style API 
-export([in/2,in_r/2,out/1,out_r/1]). 
%% Less garbage style API 
-export([get/1,get_r/1,peek/1,peek_r/1,drop/1,drop_r/1]). 
+0

ErlangのASTを解析する際、エクスポートされたモジュールが必要な場合は、すべて-export属性を見つける必要があるという欠点があります。 – Pouriya

関連する問題