Namespaces
- Posted by jzeitlin at cyburban.com Jun 25, 2001
- 576 views
I have been watching the discussion on namespaces, and thinking about the problems involved, from the standpoint of a user (as opposed to the standpoint of an implementor). I find that I am in agreement with those whose namespacing proposals leave defining the identity of the namespace in the control of the _user_ of a module, rather than in the _creator_ of the module, or the file-system (i.e., taking the namespace identity from the file name). This is because... 1. ...if control is left to the creator of the module, all we have done is moved back one level with respect to the problem that namespace creation is intended to solve - that of collision of names. By placing control of the namespace identity in the hands of the user of the module, collision is avoided (unless multiple modules may be imported into the same namespace). Granted, collision is less likely, as only namespace collision stands as an issue, rather than specific identifier collision - but a complete solution that avoids even this level of collision is preferred over a partial solution. 2. ...if control lies with the file system, we have the issue of needing to make broad changes to working programs if file names change. Such a change may be due to a move to a different Euphoria-available environment (e.g., moving from Windows to DOS), or a rethinking of the proper name of a module (as in the event of enhancement, without removing extant functionality). The broader a change that needs to be made, the more opportunity there is for introducing error, even with modern automated tools. If the user defines the namespace identity, a single change, of the name of the file imported, is all that need be made. For cross-environment portability, the need for broad change can be avoided by restricting module names to eight characters (which is the limit in DOS, the most restrictive of environments for which Euphoria is currently available) - but this itself leads to a need for potentially unclear or arbitrary names. Furthermore, as programs or modules are exchanged in source form with others, it becomes increasingly difficult to come up with useful names that avoid collision with others - unless some other solution, such as a centralized registry, is found. Given past industry experience, it is unlikely that such a centralized registry could be made to work as intended. It is to be noted that I do not propose a specific syntax for defining a namespace; while I have my preferences, none of the proposals heretofore seen for user control of namespace identity are unacceptable to me. However, I perceive direct user control over the namespace identity to be an essential component of any proposal to implement namespaces in Euphoria. -- Jeff Zeitlin jzeitlin at cyburban.com (ILink: news without the abuse. Ask via email.)