Kirk,

I've been growing my constants list exponentially for this very reason.
Since object attributes are case sensitive, the opportunity for maddening
bugs is high. Attribute name constants eliminate this. I group them with a
prefix for easy typeahead and code clarity ("PREF Save error to log attrib"
with value "pref_save_error_to_log_b") so the value also tells me the
typing of the value.

On Sat, Jun 3, 2017 at 9:40 PM, Kirk Brooks via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> David,
>
>
> On Sat, Jun 3, 2017 at 10:30 PM, David Adams via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> >
> > * Constants for strings as they make @$%@#$%@#% stupid errors from typos
> a
> > thing of the past, well, at least where they use them. This is super
> > helpful when working with property names in C_OBJECT. (Really what we
> need
> > are definable schemas for C_OBJECT contents that the compiler checks -
> > custom types - but that's a whole different discussion.)
> > ​
> >
> ​Agree. ​
> ​Since I've been using c-obj more and more for parameter passing and just
> general data handling in memory I've started using constants more than
> before for object keys exactly because of the need for keys to be exact.
> With constants the key label can be more semantic (ie: module specific
> thingy name) even when the actual key is more generic (ie: "name").
>
> And you suggestion for being able to re-load constants is good.
>
> You know what else would be good is if constants weren't stored in
> Resources but in a separate Constants folder. Why? Because they don't need
> to ship with the db if it's compiled and it's a pain to remember to remove
> them after building the compiled app.
>
> And ultimately it would be preferable for them to be integral to 4D rather
> than as an add on. ​
>
> --
> Kirk Brooks
> San Francisco, CA
> =======================
>
> *The only thing necessary for the triumph of evil is for good men to do
> nothing.*
>
> *- Edmund Burke*
> **********************************************************************
> 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:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************
>



-- 
Bob Finnerty
*Exodus Software*
**********************************************************************
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:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to