private command gotcha

Phil Davis revdev at pdslabs.net
Thu Sep 7 17:19:46 EDT 2017


On 9/7/17 2:01 PM, Monte Goulding via use-livecode wrote:
>> On 8 Sep 2017, at 3:57 am, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> Here's a surprise! You cannot dispatch to a private command or function, EVEN THOUGH the private command or function is in the SAME SCRIPT!
> Nor can you send in time… however why do you want to dispatch to the same script?

Hi Monte,
You asked me a similar question on 11-Nov-2016 - here is the 
back-and-forth. Sometimes we have our reasons! :-)
Phil Davis

> Actually here's another situation where I've used 'dispatch' simply to 
> avoid a 'do'. But I could as easily use 'send' to get the job done:
>
>
> function app_helperAppPath pAppName
>     dispatch function ( "_helperAppPath_" & the platform ) to me with 
> pAppName
>     return the result
> end app_helperAppPath
>
>
> function _helperAppPath_MacOS pAppName
>     -- Mac-specific app path discovery code
> end _helperAppPath_MacOS
>
>
> function _helperAppPath_Win32 pAppName
>     -- Windows-specific app path discovery code
> end _helperAppPath_Win32
>
>
> Phil Davis
>
>
>
> On 11/8/16 5:27 PM, Monte Goulding wrote:
>> On 9 Nov. 2016, at 12:23 pm, Phil Davis <revdev at pdslabs.net> wrote:
>>
>> Use case: You use 'dispatch' as a coding style preference.
>>
>> (That's all I could come up with.)
>
>
> Actually thinking on it I can imagine a use case but it fails if you 
> are wanting to dispatch a private handler:
>
> dispatch “SomethingOverridableInABehaviorInstance” to me
>
> command SomethingOverridableInABehaviorInstance
>     — default implementation
> end SomethingOverridableInABehaviorInstance 


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

-- 
Phil Davis




More information about the use-livecode mailing list