short name broken?
Mark Waddingham
mark at livecode.com
Thu Nov 3 04:42:26 EDT 2016
On 2016-11-01 19:12, Richard Gaskin wrote:
> You're absolutely right. When in doubt I check the
> Winkler-Kamins-DeVoto reference, and indeed they verify that all name
> queries will return a value, even when the property itself is empty.
> When using "the short name" on an unnamed object, WKD says it should
> return the ID form, as LC currently does.
I must confess I struggle to find any reasonable logic behind the
current behavior of 'the short name' when the actual name of the object
is empty. Indeed, I'd suggest that it is actually a bug (well, I guess
'anomaly' by our current definition).
As 'the short name' is not meant to return a control reference, it is
slightly unsettling that it does return a control reference in one case.
Furthermore, one would hope that the following would always be true:
the short name of (control (the short name of tControl)) is the short
name of tControl
However, if tControl has an empty name, then this actually throws an
error - breaking what would appear to be a perfectly valid invariant.
Of course, I guess the motivation here is that 'you shouldn't reference
unnamed objects by name' (presumably because objects are generally
unnamed until explicitly named, and thus you get a lots of objects with
the empty name making it usually ambiguous). However, given that it
probably just as frequent to get multiple objects with the same name
(e.g. lots of buttons with name 'button'); I'm not sure the empty name
should be considered specially.
Anyway, it is the way it has always been, as you rightly point out.
Warmest Regards,
Mark.
--
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode
mailing list