• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

20. User-Defined Functions > 20.3. Advanced Topics

Advanced Topics

There are several advanced UDF topics worth covering here, including recursion, error and exception handling, and assigning UDFs to other variable scopes. Each of these topics covers techniques that you can use to maximize the benefit of using UDFs in your applications.

Recursion

As I mentioned in the beginning of the chapter, UDFs can be called recursively. This means that a UDF can call itself until a specific condition is met. Before you start creating recursive UDFs, there are a few things you should be aware of. First, too much recursion can be a bad thing. Recursion is both processor- and memory-intensive so recursively calling a UDF too many times has the potential to drain your server’s system resources to the point where it crashes the server. The ColdFusion engineering team recommends limiting recursive calls to fewer than 800 levels. If you have a situation where you know your recursive function call has the potential to exceed 800 levels, consider using a loop instead.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint