[OpenLayers-Dev] 2.10 and 2.11-RC1 OpenLayers.Class behavior changes

Eric Lemoine eric.lemoine at camptocamp.com
Tue Aug 2 01:25:24 EDT 2011


On Mon, Aug 1, 2011 at 11:30 PM, RICHARD Didier <didier.richard at ign.fr> wrote:
>
>> On Sun, Jul 24, 2011 at 11:38 PM, Andreas Hocevar <ahocevar at opengeo.org>
>> wrote:
>>> Hi Didier,
>>>
>>> not sure if you've seen my follow-up mail. You need to re-assign the
>>> protoype after the snippet I posted. So the whole snippet would be:
>>>
>>> var X= OpenLayers.Class({
>>>   initialize:function() { this._p= "A.initialize";
>>> OpenLayers.Console.info(this._p); },
>>>   pa:"PA",
>>>   p_:null,
>>>   ma:function() { OpenLayers.Console.info("A.ma="+this.pa); }
>>> });
>>> xProto = X.prototype;
>>> xProto.initialize = function() { this.p_= "A.initialize-new";
>>> OpenLayers.Console.info(this.p_); }
>>> X = xProto.initialize;
>>> X.proto = xProto;
>>
>> Is setting xProto.initialize mandatory? How about this little
>> simplification:
>>
>> var proto = X.prototype;
>> X = function() { /* new ctor */ };
>> X.prototype = proto;
>>
>> ?
>
> I will give it a try ...
>
>>
>> I guess the same simplification should apply to Andreas' OverloadB
>> snippet.
>>
>> Cheers,
>>
>> PS: BTW, I agree there's no regression here :-)
>>
>
> Really not sure : I am still stuck with constructor modifications (when
> sub-classes use the same constructor as the superclass whose initialize
> method is beeing modified) in the class hierarchy in OL 2.11 rc1. I had no
> problem with OL 2.10 ...

Could you please provide a small test case that fails? (The simplest
possible please)

>
> If core developpers think there is no regression, a real documentation
> should be provided to developpers as a proof of it. Maybe in the test
> directory ?

Yes, in the release notes, and as unit tests.

Cheers,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Dev mailing list