Normally you should be able to give them the same name because the parameter lists should be different. If the parameter lists are not different, you may want to reconsider why you have a separate public and private version for them.
In my case, they each take and return strings. The public method firsts calls a private method which ensures that the string is valid, then it calls the private method that does the evaluation recursively.
I... what? Why even bother having two functions if one of them just calls the other and returns its value? Just put the body of fooRec into the body of foo.
I... what? Why even bother having two functions if one of them just calls the other and returns its value? Just put the body of fooRec into the body of foo.
Perhaps you should consider whether or not this code should be responsible for validating it at this point - it may be that validation is not beneficial here.
I know, but if you call it multiple times it will just return the static versions. At least that way it won't do all the processing multiple times. It's not a very good solution though, since it's still slightly slower and it's also non-re-entrant.