Is this a bug?

Phil Davis revdev at pdslabs.net
Sat Jan 20 17:57:59 EST 2007


Mark Wieder wrote:
> Chipp-
> 
> Saturday, January 20, 2007, 6:57:21 AM, you wrote:
> 
>> 'avoid time wasting confusion', then why even allow controls or objects with
>> the same name?
> 
> Yep - this has bothered me for a long time, too. I'd certainly support
> a referendum to disallow objects with the same name, but I'm afraid it
> would break backward compatibility. VB supports object instancing in
> the form of group "America"[2], but I don't care much for the syntax.
> 
But the same-named object thing can sometimes be used to advantage. Consider this:

on mouseUp
   put the groupIDs of this cd into tGroupList
   repeat for each line tTargetID in tGroupList
     switch (short name of grp id tTargetID)
     case "Section"
       doSectionStuff tTargetID
       break
     case "Page"
       doPageStuff tTargetID
       break
     case "Chapter"
       doChapterStuff tTargetID
       break
     end switch
   end repeat
end mouseUp

Admittedly, basing processing on the object name isn't the only way to do the 
above - just thought I would put my signature positive spin on yet another thing 
that can be an issue in certain contexts.  :o)

Phil Davis



More information about the use-livecode mailing list