[development] module names and namespaces

Dave Cohen drupal at dave-cohen.com
Sat Oct 16 20:41:32 UTC 2010

The function names the first thing we think of, but there are other places where the module name implies a sort of "namespace".

Variables we've mentioned, also database tables, data in the database like the authmap.module column, drupal_render data structures like $form['foo_data'], and so on...

I don't think php namespaces or another separator are enough to prevent the problem.  But simply not using '_' in a module name would.  And I say this as someone who has used '_' in module names in the past (i.e. tac_lite).  Now I understand the problem, so I won't do that again.


On Saturday 16 October 2010 10:29:58 Larry Garfield wrote:
> This is a well-known problem that comes up less often than most fear, but does 
> come up. :-)  In this case, it sounds like fb_social is Doing It Wrong(tm).  
> There's been periodic talk of changing the way hooks work to avoid this 
> problem, although that would not help with variables.  The leading contenders 
> for hooks are to switch to _hook_ as a separator rather than just _, or to use 
> PHP 5.3 namespaces.  There are open issues for both targeted at Drupal 8.  
> Personally I lean toward the namespaces approach but it's still too early to 
> know what we're going to do there, as there are a LOT of issues to consider.

More information about the development mailing list