RFC 17: Dynamic Array Sizing

Sean Gillies sgillies at FRII.COM
Mon May 15 16:39:59 EDT 2006


On May 15, 2006, at 1:28 PM, Daniel Morissette wrote:

> 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?

Daniel,

You're right, it's getLayer(index), getClass(index), etc. You can't  
directly access layers in the SWIG-generated modules unless this is a  
new feature. I got off the SWIG bandwagon around 1.3.26, so I don't  
know for sure.

>
>> 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.

Yay.

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

---
Sean Gillies
http://zcologia.com



More information about the mapserver-dev mailing list