Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6919029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:56:12+00:00 2026-05-27T09:56:12+00:00

A little background: I’m working on a project converting a webapp in another scripting

  • 0

A little background: I’m working on a project converting a webapp in another scripting language into ColdFusion. One issue I’m having is that the old technology has some function names that are the same as functions in CF, but work slightly differently. Unfortunately, in most cases I need the old functionality, so I’m planning to write my own functions.

To cause the least pain in converting the code, I was planning to prefix each function with a character not usually used in function names, e.g., $val().

I know that $ and _ are valid in function names. Are any other characters I can use? I ask because I know that some frameworks out there use this convention and I don’t want to run afoul of any of those in future development. Is it unreasonable to use multiple characters this way, e.g., $_val()?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:56:13+00:00Added an answer on May 27, 2026 at 9:56 am

    Seems reasonable to me to use $_ as a prefix. Of course, you also might want to consider giving your functions a custom ‘namespace’, via either inclusion in a custom scope structure like ‘UDF’, yielding a function named like ‘UDF.val()’; also, you could package them up together in a CFC, and access them as component methods. Either way, you would be safe from name conflicts.

    edit

    To test the comment you just made regarding custom functions with the same name as the built-in function, I made a little test to see if that’s true. It appears that you actually can build functions with the same name as the built in ones, if they are within a custom scope:

    <cffunction name="foo">
        <cfreturn "bar">
    </cffunction>
    
    
    <cfset udf = {}>
    
    <cfset udf.IsDefined = foo>
    
    <cfoutput>#udf.IsDefined()#</cfoutput>
    

    This code outputs “bar”.

    Or, if you like the CFC approach:

    foo.cfc

    component {
      function IsDefined()
      {
       return "blah";
      }
    
    }
    

    And the invoking code:

    <cfset udf2 = createObject("component", "foo")>
    <cfoutput>#udf2.isDefined()#</cfoutput>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A little background, because this might be kind of confusing: the project I'm working
For a little background: I am working on a project in C++ in which
Here is a little background information. I'm working on replacing a dll that has
First a little background about why I'm asking this question... I'm working on a
Just a little background on my project: I'm implementing an SMS encryption program using
A little background first. I am looking into the possibility of implementing Ruby's ActiveRecord
A little background: We're building a library/framework for working with scientific models. We have
For a little background information, I am trying to sync two calendars (one of
A little background I'm working on an .net application that's uses plugins heavily, the
I will give a little background. I'm working on a pay-per-click engine, and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.