>>>I am working on an old project, and there is a procedure that takes 30 Parameters. I need to expand the procedure to take 31 Parameters, but to my surprise when looking at the VFP limitation is says everywhere that the maximum number of parameters is 26. I am quite surprised because the function is working, but I am worried that there could be a problem especially when I add another one. Refactoring would be a lot of work and I really need to avoid that.
>>>
>>>So I wonder if that limitation has been removed in a certain Version of VFP, and if so which real limitation would that be?
>>
>>I know that officially the limit is 26. Why not let the function accept one of the parameters both as a value and as an array? If it's an array, the second element it treated as parameter 27 (or 31), the third element is 28 (or 32) and so on. Or you can use an object in the same way. That should require a minimum of rewrite.
>
>That is a good idea. However I try first without changing the existing parameters, because otherwise I need to make too many changes in the calling procedures. Since the new parameter is optional I can get away with only a few changes. I will do extensive testing to see if there is any problem with 31 parameters.
>But your solution is a good alternative in case I get an issue with the parameter count.
The change I suggest will NOT require any changes to the existing code, only to the new code where you need more parameters, and only a few changes to the function itself.
In the function you simply check the first parameter. If it's NOT an array (or an abject which I would prefer), the parameter is treated as normal. If it's an array (or object), you separate the elements, treat one as you used to do with the first parameter, and treat the rest of the elements as needed in your modified version.