Removal of Procedure Parameter's Effect on Call Site Arguments

Is there a way to remove a parameter from a procedure so as to cause minimal disruption to the actual argument list of existing calls to the procedure?

Before removal of parameter "z":

procedureParameters

After removal of parameter "z":

procedurParameters2

It seems that the actual arguments are moved down/over, beginning with the one removed, so that all those following the one removed are miss-assigned and the last one is unassigned.

Is there a way to avoid this so as to require less editing of the call sites?

Thanks,
-Randal

If your procedure would still work with its parameters slid down as in your example, maybe it should have just one parameter, a list or a dictionary?

Interesting idea: use a list for multiple parameters. That would make subsequent changes to the parameters easier.

However, what I am looking for is a solution after the fact: the procedure is already coded with multiple parameters and numerous calls are already present in existing code.... I want to remove a parameter that is not the last one.

It's not really a big problem ... but, as I am still somewhat of an ai2 beginner, I was wondering if there was a more sophisticated (=easier :slight_smile: ) solution.

-Randal

I think @Randal_Andress is correct here as far as a refactoring operation is concerned on the parameters. If a procedure declares parameters 1...6, and parameter 3 is removed, then 1, 2, 4...6 should remain and the parameter at position 3 should be bumped, rather than the parameter at position 6. Otherwise, the semantics of the parameters after the removed index may be altered. Other IDEs like IntelliJ will follow the semantics I've outlined (although the original interpretation is also correct for a particular definition of correctness).

@ewpatton, thanks for the response...

Being a new and occasional app inventor user, I thought that perhaps I was not removing the parameter in the proper way..

Should I submit a request for an enhancement/fix for this?

-Randal

If you feel comfortable with it, you can create an feature request on our GitHub repository.

I went ahead and gave it a whirl: Enhance procedure parameter refactoring in blocks editor #3465.

Would you mind looking it over? I added another related request.

Thanks for your help,
-Randal