RFC 17: Dynamic Array Sizing

Daniel Morissette dmorissette at MAPGEARS.COM
Mon May 15 15:28:39 EDT 2006


Frank Warmerdam wrote:
> Ned Harding wrote:
> 
>>>   layerObj **layers;
>>>   int numlayers; /* number of layers in mapfile */
>>>   int maxlayers; 
>>
>>
>> Hey Frank,
>>
>> One request...  If you are going to change the meaning of the var layers
>> or other similar vars, can you change the name?  ppLayers or something,
>> frankly anything, so its made obvious to other code that links with it?
> 
> 
> Ned,
> 
> Currently SWIG generated bindings allow script to access a layer as
> map->layers[0].name.  This would continue to work even if the layers
> became an array of pointers.  So I changing the name of layers would
> essentially break all existing mapscript applications and for that reason
> I think this change is a non-starter.
> 

I would tend to agree with Ned that changing the meaning of a variable 
in a data structure without changing its name is asking for trouble.

PHP MapScript never accesses layers, classes and styles by index 
directly, you must go through a get() method all the time. Doesn't SWIG 
MapScript have the same get() methods? Could we not hide the arrays and 
enforce the use of get() methods?

> I would add we aren't in the habit of using hungarian style prefixes in
> mapserver and I'm not that keen on introducing them widely.
> 

Agreed.

Daniel
-- 
Daniel Morissette
http://www.mapgears.com/



More information about the mapserver-dev mailing list