[Gambas-user] httpClient does not connect to a second server

T Lee Davidson t.lee.davidson at gmail.com
Mon Aug 31 18:42:43 CEST 2020


On 8/31/20 4:08 AM, John Rose wrote:
> Thanks Lee for the above. I've implemented the modifications from your diff file. Only problem is "Global variable hidden by 
> local declaration : aEpisodeData" in ExtractEpisodes procedure. I guess that won't make any difference at runtime but it would 
> be nice not to have it. I thought of using the idea (as per hData & hdataLocal in your diff file) of changing the Dim name from 
> aEpisodeData to aEpisodeDataLocal in the procedure (together with its uses in the procedure) but that then causes changes to the 
> definition & use in the SortEpisodeData procedure. Any better ideas to prevent the compilation message?

Ah, yes, another of the issues with globals. It is difficult to change individual procedures when they are dependent upon a 
global structure. Keeping data structures, where possible, localized/compartmentalized aids modularity and, therefore, debugging 
and future maintenance/enhancement.

The notice is not critical. It merely means that the global variable is not accessible from within the subroutine since it is 
'shadowed' by the local variable.

But if it bothers you (and it probably would me), the simplest way to get rid of it would be to revert ExtractEpisodes, from 
effectively a function, back to a procedure (in effective form) that receives no argument nor returns any value, but instead 
works upon the global variable. The less simple way is to convert SortEpisodeData into a function that receives and returns a 
String[][] and, of course, changing the local variable names eg. to aEpisodeDataLocal.


-- 
Lee


More information about the User mailing list