introspection: current handler name?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

slowmaker
Posts: 47
Joined: Fri Feb 08, 2019 1:53 pm

introspection: current handler name?

Post by slowmaker » Sat Jan 18, 2020 3:55 pm

Is something like this possible?

Code: Select all

on foo
    answer the handlerName -- or whatever the keyword is, it it exists
end foo

on bar
    answer the handlerName
end bar

on baz
    foo
    bar
end baz
so calling baz would produce two consecutive message dialogs, one saying "foo" and the other saying "bar".

Fooled around a little with "answer the message", "answer message", but no dice.
Suggestions?
Just not supported at present?
other?
The important thing is not to stop questioning. Curiosity has its own reason for existence. - Albert Einstein (LIFE Magazine (1955 may 2), p64)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: introspection: current handler name?

Post by dunbarx » Sat Jan 18, 2020 4:14 pm

Hi.

I think I know what you are asking, though I bet that rethinking your ideas may be in order. But anyway, does this help at all? Make a button. In the button script:

Code: Select all

on mouseUp
baz
end mouseUp

on baz
   foo
   bar
end baz

on foo
   answer item - 2 of the executionContexts 
end foo

on bar
   answer item - 2 of the executionContexts 
end bar
Craig
Last edited by dunbarx on Sat Jan 18, 2020 4:39 pm, edited 1 time in total.

slowmaker
Posts: 47
Joined: Fri Feb 08, 2019 1:53 pm

Re: introspection: current handler name?

Post by slowmaker » Sat Jan 18, 2020 4:36 pm

Thank You!
yes, that executionContext is exactly the kind of thing I was thinking of!

Now for a side track:
dunbarx wrote:
Sat Jan 18, 2020 4:14 pm
I think I know what you are asking, though I bet that rethinking your ideas may be in order.
I'm curious what you mean here; I'm trying to get better at communicating on this board, as I seem to have a knack for making people think I'm after one thing when I'm actually after another.

I was attempting to give the simplest quickie example I could think of, as context-free as possible, in order to demo the characteristic of the code environment I was curious about.

Clearly I failed, so...what did it appear I was shooting for?
The important thing is not to stop questioning. Curiosity has its own reason for existence. - Albert Einstein (LIFE Magazine (1955 may 2), p64)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: introspection: current handler name?

Post by dunbarx » Sat Jan 18, 2020 4:44 pm

Your mistake was communicating with me at all. I try to make things as convoluted as possible.

We must be wary of each other.

But my point was that if you are trying to identify and isolate the names of other handlers in a script and then use them in some manner I would rethink your, er, thinking. I bet that there is a more direct and straightforward method. Of course, I have no idea of your thinking or of your goal, so please give an outline of your plan.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: introspection: current handler name?

Post by dunbarx » Sat Jan 18, 2020 4:50 pm

Me again.

Initially, I thought you might be after something like this:

Code: Select all

on mouseUp
baz
end mouseUp

on baz
   foo
end baz

on foo
   do item - 2 of the executionContexts  -- WILL CAUSE A RECURSIVE FAILURE
end foo
That is, that you could isolate a handler and execute it "remotely". Maybe I was close? In any case, read about the executionContexts, as it contains a wealth of information about all handlers accessed in a particular running script.

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: introspection: current handler name?

Post by bogs » Sat Jan 18, 2020 5:12 pm

slowmaker wrote:
Sat Jan 18, 2020 4:36 pm
I'm trying to get better at communicating on this board, as I seem to have a knack for making people think I'm after one thing when I'm actually after another.
I've been trying to accomplish that since I signed on here, but you're fighting a few things that are (imho) hard to overcome, not the least of which is interpretation versus point of view.

In other words, it is hard enough to communicate in person when the other person (people) can actually see your face and interpret your tone of voice, it is a factor of difficulty higher when all you have is text :roll:

Usually it winds up something like this -
aPic_NoOneIsPerfect.png
...if you see what I mean... ?!
Eventually, if a given problem is gone over a few times, though, the correct idea eventually comes out (most of the time) :D
Image

slowmaker
Posts: 47
Joined: Fri Feb 08, 2019 1:53 pm

Re: introspection: current handler name?

Post by slowmaker » Sat Jan 18, 2020 5:18 pm

I think I begin to see, dimly...

The thing that might throw others -- you in this case but probably most others also -- is that there is no higher-level or overall-task-oriented goal here (and quite often in other questions from me).

I was just curious whether that level of self-awareness, so to speak, was possible in Livecode (and pleased to see that it is).

I mean, yes, there was a particular situation that prompted the idea, but by the time I asked the question, it wasn't about that specific situation anymore, I just wanted to know if it was possible. (and no, the situation was not the kind of thing you describe above, nothing that tricky) (and no, I'm not going to tell what the situation was; see below)

So...past experience indicates that if I describe a specific situation (not just here, any message board), readers latch on to that situation, and answers have a very high probability of containing The Internet Answer: "no, no, you don't want to do it that way at all" along with many well-meaning suggestions for completely different routes to dealing with that situation.
Which is fine for questioners who just want to handle the situation and move on.
But not quite as fine if the questioner is me, who is genuinely curious about a particular attribute of the situation, regardless of whether that attribute is useful/good way to handle things, or not.

Thus, my current method of phrasing requests will probably be in flux for a while (likely forever)

and @Bogs
And, yeah, I get what you're saying, Bogs, but I can try, can't I :)
I've read posts -- not often, but here and there about the net -- in which people do succeed in communicating clearly and correctly in spite of the limitations of text. I like the idea of at least trying to be more like them, even if I never succeed...
The important thing is not to stop questioning. Curiosity has its own reason for existence. - Albert Einstein (LIFE Magazine (1955 may 2), p64)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: introspection: current handler name?

Post by dunbarx » Sat Jan 18, 2020 5:28 pm

We are going to have a great time with LC. There was nothing peculiar about your post. It was I that read stuff into it.

I look forward to anything you have in mind, from the specific to the theoretical. Each response gets me out of doing my day job for just a short while.

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: introspection: current handler name?

Post by bogs » Sat Jan 18, 2020 5:41 pm

slowmaker wrote:
Sat Jan 18, 2020 5:18 pm
@Bogs
And, yeah, I get what you're saying, Bogs, but I can try, can't I
My post is a good case in point, I was trying to encourage you to go right on trying, just don't sweat it if it doesn't come across as you intended, eventually it will (if you hang in there long enough), but I think that was lost in the translation :wink:
Image

slowmaker
Posts: 47
Joined: Fri Feb 08, 2019 1:53 pm

Re: introspection: current handler name?

Post by slowmaker » Sat Jan 18, 2020 5:58 pm

bogs wrote:
Sat Jan 18, 2020 5:41 pm
My post is a good case in point, I was trying to encourage you to go right on trying, just don't sweat it if it doesn't come across as you intended, eventually it will (if you hang in there long enough), but I think that was lost in the translation :wink:
Yep, got that; my response was itself a good example of me dashing off a couple of lines and not clearly acknowledging that I was just responding to the first couple of lines in your post even though I did read and understand the rest.

And of course, us going back and forth at all just helps illustrate your point no matter which way you slice it :D
dunbarx wrote:
Sat Jan 18, 2020 5:28 pm
... Each response gets me out of doing my day job for just a short while.
Excellent. Glad I can help with productivity reduction!
The important thing is not to stop questioning. Curiosity has its own reason for existence. - Albert Einstein (LIFE Magazine (1955 may 2), p64)

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: introspection: current handler name?

Post by bogs » Sat Jan 18, 2020 6:12 pm

Exactly so :D
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: introspection: current handler name?

Post by dunbarx » Sat Jan 18, 2020 8:59 pm

Excellent. Glad I can help with productivity reduction!
What makes you think that my not working reduces productivity?

Craig

slowmaker
Posts: 47
Joined: Fri Feb 08, 2019 1:53 pm

Re: introspection: current handler name?

Post by slowmaker » Sat Jan 18, 2020 11:27 pm

dunbarx wrote:
Sat Jan 18, 2020 8:59 pm
Excellent. Glad I can help with productivity reduction!
What makes you think that my not working reduces productivity?

Craig
Hm. It's (the inverse of) an assumption, one of three possibles:
1) you working increases productivity
2) you working makes no difference whatsoever in productivity
3) you working decreases productivity (e.g. you've been hired by the competitor to sabotage your nominal employer)

The possibility of it being numbers 2 or 3 is intriguing; are you preparing to assert one of those?
The important thing is not to stop questioning. Curiosity has its own reason for existence. - Albert Einstein (LIFE Magazine (1955 may 2), p64)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: introspection: current handler name?

Post by dunbarx » Sun Jan 19, 2020 9:31 pm

4- You will have to stop thinking of me as a rational person.

Craig

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: introspection: current handler name?

Post by mwieder » Mon Jan 20, 2020 6:09 pm

LOL. :shock:

FWIW, I thought the original post in this thread was/is pretty clear.
Although I also got that just from the "introspection" in the subject.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”