C および Perl: すべて小文字で _ でつなぎます。 _ ではじまる関数はプライベートです。
関数名に曖昧な動詞は避ける。関数名に数字をつけない。
C や Perl のトップレベルの関数では
$curproc->${object}_{action}();のような命名ルールを使います。 たとえば次のようなルールです。
$curproc->message_create(); $curproc->message_generate_sub_part(); or message_sub_part_generate(); $curproc->message_XXX(); $curproc->message_destroy();これは疑似的にオブジェクトぽくみせるためでもあります。
一方、オブジェクトとしてコーディングしている場合は、 英語の語順ぽく書きます。 よってオブジェクトは名詞、メソッドは動詞です。
$message->new(); $message->generate_sub_part(); $message->XXX(); $message->DESTROY();
basically, the following style:
S->V_O form $self->verb_object. $self->run().where the verb are
1) usual verb: run, do, ... 2) perl style: substr, errstr, as_str, XXX_as_str, str_ref, ... 3) C system calls or functions: dup, ... 4) abbrebiation: cleanup (not clean_up), setup, cutoff, reschedule ...
class exceptions: if two words are closely binded.
$CLASS->$SUBCLASS_METHOD or $CLASS->${SUBCLASS}{METHOD} style are possible. $self->db_{open,close}(); $self->html_{start,end}(); (since start_html is alrady used in CGI class) ${FML::MTA::Control OBJECT}->postfix_install_alias(); ${IO::Adapter OBJECT}->sequence_METHOD(); $self->smtplog(); $self->error_clear(); $self->error_set(); $string->charcode_convert_XXX(); (charset_convert is a word ?)
FML::Process:: fml8 top level exception:
[main flow is normal order] $curproc->new(); $curproc->prepare(); $curproc->verify_request(); $curproc->run(); $curproc->finish(); $curproc->help(); $curproc->stop_this_process(); $curproc->do_nothing(); $curproc->be_quiet(); $curproc->exit_as_tempfail(); [top of top level is capitalized to emphasis the exception] main::Bootstrap2() (FML::Process::Switch) FML::Process::Switch::NewProcess FML::Process::Flow::ProcessStart
fml8 top level general case (not top, 2nd / 3rd level method):
[$curproc->$subclass_method form] $curproc->command_context_XXX(); (FML::Process::State) $curproc->config_XXX(); config_cf_XXX config_cf_files_XXX $curproc->default_config_cf_XXX(); "default_config_cf" is a term. $curproc->tmp_file_XXX();
Copyright (C) 1993-2025 Ken'ichi Fukamachi mail:< fukachan at fml.org >