Naming conventions for optional parameters
Dar Scott
dsc at swcp.com
Mon May 26 13:19:01 EDT 2003
I noticed at here...
http://www.fourthworld.com/embassy/articles/scriptstyle.html
... a naming convention in which parameters are named as such:
pLength
I wonder if folks use an alternate prefix for optional parameters.
These usually fall into two classes.
The first is the tail-optional group. These are dropped from the
right. They may contain empty which is distinct from being missing.
These are tested with paramCount().
The second is the empty-means-default group. These may be replaced
with empty at any place in the parameter list and also may be dropped
from the right. These are tested with "is empty".
I'm considering using an alternate prefix for these. Will this help or
will it muddy the waters?
Maybe, to comply with the above, they can be "pt" and "pe".
Example:
on toast pToaster, peTemperature, pBread, peNumber, ptProfile,
ptAnnouncement, ptReport
An alternative that doesn't use prefixes is this (which limits classes
to one):
on toast pToaster, pBread, /* optional: */ pTemperature, pNumber,
pProfile, pAnnouncement, pReport
Dar
More information about the use-livecode
mailing list