• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

dynamic function names

gigapet

Lifer
is it possible to create dynamic function names.

for instance:

dim random

random = "test"
random = random & counter <------where counter is a variable that is incremented each time through a loop

function random_cheeseburger
blah blah
end function

 
Hi

Would you mind expanding on your explanation of what you need to accomplish, you are a tad too vague for me!

Regards

Nick
 
I haven't seen any language where you can do that. You always need to use a reference to the function. What good would doing that be, anyway?
 
Not in C/C++, but as Nothinman says you can use function pointers -- for example some sorting libraries take a function pointer to (any) comparison function as one of their arguments.
 
Originally posted by: gigapet
Originally posted by: MrChad
Sounds like a code readability nightmare.

yeah probably screw it its not that important.

I've done something similar before, but I used pointers like Nothinman said. It didn't really accomplish anything.
 
In ASP you can do more than redefine the function name. You can redefine the function itself mid-script. Just put all the variations of the function you want to call in includes then include the one you want right before calling it.

Code readability nightmare is an understatement. If you goal is not obfuscation, there is always a better way.
 
In python, a function is just an object like anything else. You can pass it around (python passes by reference), call it, assign it to other names, redefine it, delete it, etc.
 
Back
Top