in reply to function call / return philosophies

In most languages that allow this kinda of thing its called "overloading" the function. It can behave differently based on what input parameters. Some really stronly typed languages (ada) allow overloading on input and output parameters.

It can be usefull but also add to confusion and maintenance issues.

I would sugest as someone else has always return the same type.

Or better in my opinion have 2 functions (maybe add county_names_by_ids()) Of course this new routine could just call the orginal and return a populated array saving code duplication. It would be pretty much the same code you have now just in 2 routines.

  • Comment on Re: function call / return philosophies