Re: [development] need a standard for contrib node build_mode constants
Maybe I'm missing something here, but it's just as possible to accidentally re-use a string constant as a numeric constant. How does using a string help things at all? Either the developer reads and enumerates a list of all existing uses and avoids collision -- or does not -- regardless of whether they are integers, strings, or ice cream flavors. Please educate me! ..chris On Tue, May 19, 2009 at 12:12 PM, John VanDyk <jvandyk@iastate.edu> wrote:
To the contrary, Peter's proposition makes a very good standard to avoid collisions, it's actually better than strings IMO.
To really make it unique, you'd want to prepend your drupal.org uid and append your shoe size.
Chris Johnson wrote:
Maybe I'm missing something here, but it's just as possible to accidentally re-use a string constant as a numeric constant. How does using a string help things at all? Either the developer reads and enumerates a list of all existing uses and avoids collision -- or does not -- regardless of whether they are integers, strings, or ice cream flavors.
Please educate me!
Strings have meaning. Ints do not. Therefore if there is a collision it is at least a collision over meaning.
Or we could have a factory function that takes a string hint and returns a lightweight object based on the hint. This might actually open the door to making the build mode useful, as you could delegate build-mode specific actions to the build mode object. It would also make the system extensible because you could provide a sub-class of any existing build mode object and the factory function would have to return that instead, even though you had passed in the same hint. Robert Douglass The RobsHouse.net Newsletter: http://robshouse.net/newsletter/robshousenet-newsletter Follow me on Twitter: http://twitter.com/robertDouglass On May 19, 2009, at 8:08 PM, Earl Miles wrote:
Chris Johnson wrote:
Maybe I'm missing something here, but it's just as possible to accidentally re-use a string constant as a numeric constant. How does using a string help things at all? Either the developer reads and enumerates a list of all existing uses and avoids collision -- or does not -- regardless of whether they are integers, strings, or ice cream flavors. Please educate me!
Strings have meaning. Ints do not. Therefore if there is a collision it is at least a collision over meaning.
With string constants you follow (or at least should) the naming convention that the first part is the module name. nevets
participants (4)
-
Chris Johnson -
Earl Miles -
Robert Douglass -
Steve Ringwood