At 10:30 PM 11/2/2001, you wrote: > >If serviceAvailable() requires the use of the external variable >application.services I would say that it is a Bad Thing (TM) if you can >invoke it like serviceAvailable('borkyService'). The UDF should be >modified so it has to be invoked by sending all external variables, >serviceAvailable('borkyService',application.services) > > ><cf_snip> > > > in conclusion I think that not having locks in CFSCRIPT is causing the > > break of scope. > > >I think bad UDF implementation is causing break of scope in your example >for the reasons stated above, and I completely agree with Birgit. > >Jochem
I still disagree, why should my greater application have or want to know anything about how serviceAvailable() and related UDFs do the job they say they will ? Surely by having to control access to application.services from outside serviceAvailable I am breaking the encapsulation of this function, and related functions. Now fair enough, unless the functions say they will be using application.services there is a chance that this could be trampled on by other code, there is give and take here. Perhaps it is better for me to refer not to a single function but to a library of functions. Essentially what we are doing when using a number (possibly 1) of related UDFs is using a library implementation of a specific function. Imagine for the moment that the following functions are made available to a C, or Java, or C++ (etc) program by the utilization of a specific library which states it is thread safe - serviceAvailable(), addService(), delService(). Now, IMHO, to use this library, _nothing_ extra of the calling code should be required to support it, we should not have to create a global structure to hold services or perform the locking required to manage the use of it by the functions in the library (because it is supposed to be thread safe). All we should do is #include "serviceLib.h" use the functions it provides and link it in to our executable, serviceLib is fully encapsulated opening only a tiny interface to the outside world through it's functions. The chance of a user of serviceLib screwing things up because of a poor locking implementation by the user. So tell me why this written in CF as UDFs should be any different ? Can you tell I like OO :-) ---------- James Sleeman Innovative Media Ltd Phone: (03) 377 6262 http://www.websolutions.co.nz/ CAUTION: The information contained in this email message is confidential and may be legally privileged. If the reader of this message is not the intended recipient you are notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify the sender immediately and destroy the original message and any attachments. Views expressed in this communication may not be those of Innovative Media Ltd. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists