4D should have a constants editor, just like it has the list editor. But it
doesn't. I've gone both way on constants in 4D. I now use 4DPop for this
feature (and nothing else.) It's a bit of a pain but not terrible. I tend
to add a bunch of constants in a go and then not need to change them again
for ages. I don't know, that's got to be more to do with how I write code
than anything else, I guess. Note that since constants are an external XML
file, it's possible to write them by hand on-the-fly. I never have, but you
could.

There are a couple of advantages to constants, the main thing being in the
name "constant" versus "variable":

* They are constant. You can't accidentally set them to different values at
different times. Huge deal.

* There is no way to accidentally fail to initialize them.

* They display with the underline, making them distinctive. I think that
makes code a bit nicer. At the least, it makes it obvious to another 4D
programmer that you've got constants rather than variables.

IP vars are easier to work with but their value can be inconsistent and
there's no way to know if they're constants apart from convention. If you
do go that way, I'd recommend naming constants in all upper-case, like many
languages. It's ugly, but at least your pseudo-constants look like
something different from regular IP variables.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to