Page 1 of 1

what is the difference between command and own on ...

Posted: Sat Feb 13, 2021 11:22 pm
by fhs14647
Dear Experts

What is the difference/benefit between an own message handler or a command for using them. I made this coding just for demonstrating my question.

Code: Select all

on mouseUp
   ## own message with same output
   informing
   ## command with same output
   inform
end mouseUp

on informing
   answer "This is an information about 'on informing'"
end informing

command inform
   answer "This is an information with command 'informing'"
end inform

Thanks a lot
Mike

Re: what is the difference between command and own on ...

Posted: Sat Feb 13, 2021 11:51 pm
by Davidv
They are synonyms.

adding... I have been using Livecode and its predecessors "forever" and I had never noticed that command existed. Given on has near a quarter the characters, I think I will keep using that. :)

Re: what is the difference between command and own on ...

Posted: Sun Feb 14, 2021 12:05 am
by fhs14647
Davidv wrote:
Sat Feb 13, 2021 11:51 pm
They are synonyms.

adding... I have been using Livecode and its predecessors "forever" and I had never noticed that command existed. Given on has near a quarter the characters, I think I will keep using that. :)
:D :)

Re: what is the difference between command and own on ...

Posted: Sun Feb 14, 2021 12:29 am
by SparkOut
They are synonyms to all intents and purposes that I know, but once upon a time, there was a suggestion that "on" be used for system messages (eg on mouseUp) and "command" be used for custom handlers.
There was an implication that maybe one day there would be a use case where this mattered beyond styling.
I don't think that use case ever raised its head so far. I did once answer a similar question thinking that you couldn't define a private handler with "on" but even that was debunked.

Re: what is the difference between command and own on ...

Posted: Sun Feb 14, 2021 9:54 am
by fhs14647
OK, thanks for your answer!

Re: what is the difference between command and own on ...

Posted: Sun Feb 14, 2021 5:16 pm
by dunbarx
What Sparkout said.

I am too old to use "command" for my own handlers, sticking with "on" everywhere. I am not sure I would notice any advantage to separating these, since I cannot even understand my own code ten minutes after I write it.

Craig

Re: what is the difference between command and own on ...

Posted: Sun Feb 14, 2021 6:06 pm
by fhs14647
:D :) :lol:

Re: what is the difference between command and own on ...

Posted: Sun Feb 14, 2021 6:44 pm
by Klaus

Re: what is the difference between command and own on ...

Posted: Sun Feb 14, 2021 8:15 pm
by SparkOut

Re: what is the difference between command and own on ...

Posted: Sun Feb 14, 2021 8:22 pm
by bogs
Maybe you better quote it, SparkOut :wink:

Image

Re: what is the difference between command and own on ...

Posted: Sun Feb 14, 2021 8:58 pm
by SparkOut
????
It's not visible, because it's the Commercial forum?
Well I can't easily quote the whole thread, but anyway it just repeats much of the other thread Klaus linked. I only referenced it as that was where it was pointed out that you can actually declare a handler as "private on handlerName".