Почему именя некоторых функции начинаются со знака подчеркивания?

Главные вкладки

Аватар пользователя nleo nleo 15 августа 2009 в 15:17

Собственно вопрос. Например _node_gallery_gallery_view() Давно было интересно узнать это просто так или что-то значит и как-то используется.

Комментарии

Аватар пользователя penexe penexe 15 августа 2009 в 23:34

Encapsulation

Like most other object-oriented systems, Drupal does not have a way of
strictly limiting access to an object's inner workings, but rather relies
on convention to accomplish this. Since Drupal code is based around
functions, which share a single namespace, this namespace is subdivided by
the use of prefixes. By following this simple convention, each module can
declare its own functions and variables without the worry of conflict with
others.

Convention also delineates the public API of a class from its internal
implementation. Internal functions are prefixed by an underscore to
indicate that they should not be called by outside modules. For example,
_user_categories() is a private function which is subject to change without
notice, while user_save() is part of the public interface to the user
object and can be called with the expectation that the user object will be
saved to the database (even though the method of doing this is
private).
http://drupal.org/node/547518