private handlers in a public library

Mark Smith mark at maseurope.net
Wed Dec 6 22:12:50 EST 2006


Depending on what you need to achieve, you can put data in script  
locals in your library, write some setter and getter handlers (an  
interface, if you like), and then the data is private...

Other than that, you might hide the handlers in objects in the  
library stack, and use a lot of  "sends".

Seems like it would be a lot of trouble, your way seems better, but  
with the caveat that the execution contexts is  
'unsupported' (private?) and might concievably change in the future,  
breaking your library.

Of course, if you really want to hide things, you could password  
protect your library, and only tell it's users about the handlers you  
want them to know about.

Best,

Mark

On 7 Dec 2006, at 01:24, Dick Kriesel wrote:

> What are the best practices for hiding private handlers in a public  
> library?
>
> I Googled "'private handler' site:lists.runrev.com" and similar terms
> without finding the answer.  If the topic's been covered and I  
> missed it,
> please excuse me.
>
> Here's a technique that uses the executionContexts:
>
> on privateHandlerInPublicLibrary
>   if item 1 of line -2 of the executionContexts is long id of me then
>     return the params && the long time -- i.e., "private" stuff
>   else pass privateHandlerInPublicLibrary
> end privateHandlerInPublicLibrary
>
> function privateFunctionInLibrary
>   if item 1 of line -2 of the executionContexts is long id of me then
>     return the params && the long time -- i.e., "private" stuff
>   else pass privateFunctionInLibrary
> end privateFunctionInLibrary
>
> getprop uPrivatePropertyInLibrary
>   if item 1 of line -2 of the executionContexts is long id of me then
>     return the params && the long time -- i.e., "private" stuff
>   else pass uPrivatePropertyInLibrary
> end uPrivatePropertyInLibrary
>
> setprop uPrivatePropertyInLibrary
>   if item 1 of line -2 of the executionContexts is long id of me then
>     return the params && the long time -- i.e., "private" stuff
>   else pass uPrivatePropertyInLibrary
> end uPrivatePropertyInLibrary
>
> Object backScripts would make it simpler, but what's best now?
>
> -- Dick
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list