Talk:State
Revision as of 15:44, 27 January 2013 by Omei Qunhua (talk | contribs) (→Constant vs Explicit values?)
Constant vs Explicit values?
I've noticed an ongoing style difference in recent edits, namely in the preference between named constants versus explicit values... as can be seen from difference in edits for this entry (namely 0 or PUBLIC_CHANNEL). I have no preference either way, and can see merits for both (the named constant is more informative to new users [tells what it does], the explicit value more informative to experienced users [tells what it is])... AFAIK neither compiler actually cares one way or the other so there appears not to be any side effects. should we settle on a preference?
-- Void (talk|contribs) 08:35, 27 December 2012 (PST)
- My feeling was that new users are initially introduced to llSay(0, ... as that is what they are presented with from the very start with 2 occurrences in the default "new script". Using PUBLIC_CHANNEL in Wiki examples immediately adds a layer of confusion. Adding an explanatory comment each time seems like an admission that we've confused them, especially a comment that says "PUBLIC_CHANNEL has the integer value 0" ... as that is demonstrating the need to explain PUBLIC_CHANNEL rather than explaining '0' --- it's akin to a child being told "I think you'll find it easier to call me FEMALE PARENTAL HUMAN rather than Mum as that explains my role better" ... whereas Mum is what the child grew up with. SL scripters all 'grow up' with '0' as the open chat channel. I am strongly in favour of 99.9% of mnemonic constants, but 0 for channel 0 seems like a special case. For example CHANGED_OWNER is eminently more sensible than trying to remember the value 128. While we're at it, I do detest (float)FALSE and (float)TRUE ... if you really want to use TRUE and FALSE for the extremes of Alpha, then let the compiler auto-cast it for you e.g. llSetAlpha(FALSE, ALL_SIDES) but llSetAlpha(0.0, ALL_SIDES) says it much better for me and has the right flavour, as it's one value on a sliding scale. Omei Qunhua 14:31, 27 December 2012 (PST)