Problem naming groups with integers

Kay C Lan lan.kc.macmail at gmail.com
Mon Apr 21 04:44:39 CEST 2014


On Sun, Apr 20, 2014 at 7:05 AM, Peter Haworth <pete at lcsql.com> wrote:

> I think the same advice applies to datagrid column names.
>
> The advise applies to naming EVERYTHING in LC. I don't know how to link to
old posts so I'll just repost my own recent naming faux pas:

As heads up for others who may not have read/remembered this, let me share
a very recent experience that resulted in a properly corrupted stack file.

In my shear brilliance (shortsightedness) I created a script that ran
through a bunch of Folders on my HD and created a custom property set the
name of each being the folder's name. It then created a custom property for
each file within that folder, the CP name being the name of the file, the
contents of the CP being some metadata about the file. To cap off my near
genius (stupidity) I ran the file names through urlEncode() as I was going
to send some of the info across a network.

Great, a dozen or so CPSs created with a couple of hundred CPs in each, all
using array notation, all done in a blink of the eye. Everything worked
fine for a while. A glance at the CPSs and the CPs with the Inspector all
looked good. And then things started misbehaving, and then it all went The
Omen on me, my stack was possessed. Scripts didn't work any more, strange
data was turning up in variables, CPSs and CPs started disappearing, the
Inspector started showing some data from one object and other data from a
different object.

I'm pretty sure the cause was this, from the LC User Guide:
----------------

Custom Property Names

The name of a custom property must consist of a single word and may contain
any combination of letters, digits, and underscores (_). The first
character must be either a letter or an underscore.

Custom Property Set Names

The names of custom property sets should consist of a single word, with any
combination of letters, digits, and underscores (_). The first character
should be either a letter or an underscore.

It is possible to create a custom property set with a name that has more
than one word, or that otherwise doesn't conform to these guidelines.
However, this is not recommended, because such a custom property set can't
be used with the array notation described below.

----------------
THESE NAMING CONVENTIONS DO NOT APPEAR IN THE DICTIONARY, at least not
under the entries for customProperties, customPropertySet,
customPropertySets. And, as if to tempt you into dark and foreboding
corners, the example for customPropertySet is:

set the customPropertySet of me to "Mac Properties"

Needless to say, I had several folders whose name was either multi-word
and/or started with a digit. For file names, although the use of urlEncode()
accidentally solved the problem of multi-word names, it merely passed the
buck by introducing characters such % and + instead of commas, spaces and
parenthesis. I still had many file names and therefore CP names which
started with a digit and EVERYONE included a period.

Now whether or not LC should have stopped me from creating such is a mute
point. It did, things worked for a while using array notation, and then it
broke.


More information about the use-livecode mailing list