> On 10 Aug 2017, at 2:25 am, Bob Sneidar via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> I have a function that returns the stack of an object by passing the long id 
> of the object. getParentStack(the long id of me). All it does is parses the 
> long id by using wordOffset to find the word "stack" then returns word tWord 
> to -1 of the long id. Pretty basic. 
> 
> That method can be used for anything, from the owner to the card to the first 
> group etc. I don't think we need more properties per se. 

Yes we have these kinds of functions in the ide too. I just think we shouldn’t 
need something that depends on the format of a long ID to do something so 
common as to get a reference to the card of a control or stack of anything. 

One day I dream of an object reference that we can get and use that is not a 
string that needs to be resolved every time it’s used but a direct reference to 
the object. Perhaps if someone tries to do a string operation on it then it 
would be turned into a long id string just like when someone tries to do “1” + 
1 it’s turned into a number. But if it’s just passed around or stored in a 
custom property then it remains a resolved handle to the object and can cope 
with things like the ID or name or filename being changed in the session. If we 
had that we would want things like `is a {stack | card | button …}` and `{stack 
| card | mainstack} of`.

I have actually thought about whether it would be reasonable for `the long id` 
to return such an object reference as it would stringify automagically if 
necessary. However, deleting the object would mean the string form couldn’t be 
created so that probably wouldn’t work... I think complex objects that handle 
many object references and the IDE would have a significant bump in speed if we 
did such a thing.

Cheers

Monte
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to