Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-22 Thread Daniel Friesen
On Thu, 22 Mar 2012 03:22:10 -0700, Dmitriy Sintsov wrote: * Daniel Friesen [Thu, 22 Mar 2012 01:40:16 -0700]: That's the very definition of an array. An array is a list, the keys are indexes. By definition you cannot have an index that does not exist. If PHP arrays are sparse, includin

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-22 Thread Dmitriy Sintsov
* Daniel Friesen [Thu, 22 Mar 2012 01:40:16 -0700]: That's the very definition of an array. An array is a list, the keys are indexes. By definition you cannot have an index that does not exist. If PHP arrays are sparse, including numeric ones. They are actually like hashmaps I think so. I do

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-22 Thread Daniel Friesen
On Thu, 22 Mar 2012 00:15:40 -0700, Dmitriy Sintsov wrote: * Krinkle [Wed, 21 Mar 2012 18:51:45 +0100]: Few points: * The easiest way to understand it is to consider "sparse arrays" to not exist in javascript. It doesn't throw an exception if you try it, but it's not supposed to be

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-22 Thread Dmitriy Sintsov
* Dmitriy Sintsov [Thu, 22 Mar 2012 11:15:40 +0400]: In Chrome, executing the following code: var a = []; a[0] = 'a'; a[2] = 'c'; worked, however debugger inspector shows 'undefined' elements between real elements of array. And the length is counted for 0..last element, including the undefs. How

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-22 Thread Dmitriy Sintsov
* Krinkle [Wed, 21 Mar 2012 18:51:45 +0100]: Few points: * The easiest way to understand it is to consider "sparse arrays" to not exist in javascript. It doesn't throw an exception if you try it, but it's not supposed to be posisble, so don't. In Chrome, executing the following cod

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-21 Thread Krinkle
On Mar 20, 2012, at 11:15 AM, Dmitriy Sintsov wrote: > * Krinkle [Mon, 19 Mar 2012 14:32:51 +0100]: > Converted all of for..in into $.each(). The most funny thing is that > $.each() did not work correctly with sparse arrays [], walking with > "undefs" between real elements. While for..in used to

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-20 Thread Dmitriy Sintsov
* Krinkle [Mon, 19 Mar 2012 14:32:51 +0100]: Converted all of for..in into $.each(). The most funny thing is that $.each() did not work correctly with sparse arrays [], walking with "undefs" between real elements. While for..in used to work fine (FF,Chrome,IE8,IE9). So I had to convert sparse

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-19 Thread Daniel Friesen
On Mon, 19 Mar 2012 06:23:13 -0700, Krinkle wrote: On Mon, Mar 19, 2012 at 9:35 AM, Daniel Friesen wrote: On Mon, 19 Mar 2012 00:40:54 -0700, Dmitriy Sintsov wrote: var jqgmap = []; for ( var mapIndex in jqgmap ) { This is VERY bad JavaScript coding practice. Please use $.each(). T

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-19 Thread Dmitriy Sintsov
On 19.03.2012 17:23, Krinkle wrote: On Mon, Mar 19, 2012 at 9:35 AM, Daniel Friesen wrote: On Mon, 19 Mar 2012 00:40:54 -0700, Dmitriy Sintsov wrote: var jqgmap = []; for ( var mapIndex in jqgmap ) { This is VERY bad JavaScript coding practice. Please use $.each(). This is rather exagge

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-19 Thread Krinkle
On Mon, Mar 19, 2012 at 2:23 PM, Krinkle wrote: > On Mon, Mar 19, 2012 at 9:35 AM, Daniel Friesen > wrote: > >> On Mon, 19 Mar 2012 00:40:54 -0700, Dmitriy Sintsov >> wrote: >> var jqgmap = []; >> >>> for ( var mapIndex in jqgmap ) { >>> >> >> This is VERY bad JavaScript coding practice. Plea

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-19 Thread Krinkle
On Mon, Mar 19, 2012 at 9:35 AM, Daniel Friesen wrote: > On Mon, 19 Mar 2012 00:40:54 -0700, Dmitriy Sintsov > wrote: > var jqgmap = []; > >> for ( var mapIndex in jqgmap ) { >> > > This is VERY bad JavaScript coding practice. Please use $.each(). > This is rather exaggerated. Even more when l

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-19 Thread Daniel Friesen
On Mon, 19 Mar 2012 02:07:54 -0700, Dmitriy Sintsov wrote: * Daniel Friesen [Mon, 19 Mar 2012 01:35:21 -0700]: Autoloading classes is not possible. Even if every browser supported getters and we could use them to dynamically load classes, this would require synchronous http calls. Which ar

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-19 Thread Dmitriy Sintsov
* Daniel Friesen [Mon, 19 Mar 2012 01:35:21 -0700]: ( function( $, mw ) { } )( jQuery, mediaWiki ); I modified all of three modules: main, view and edit module to the recommended pattern. http://pastebin.com/1kS6EyUu http://pastebin.com/WQzBTw6W http://pastebin.com/UqpTAvZ8 However, the exe

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-19 Thread Dmitriy Sintsov
* Daniel Friesen [Mon, 19 Mar 2012 01:35:21 -0700]: Autoloading classes is not possible. Even if every browser supported getters and we could use them to dynamically load classes, this would require synchronous http calls. Which are absolutely HORRIBLE because they block the entire JS thread and

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-19 Thread Daniel Friesen
On Mon, 19 Mar 2012 00:40:54 -0700, Dmitriy Sintsov wrote: Hi! I've tweaked my code few times, trying to make it simpler: got rid of some closure calls and left only one dynamic module load at client-side. http://pastebin.com/UxyifLmx http://pastebin.com/q3Tm6Ajd http://pastebin.com/4emMD

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-19 Thread Dmitriy Sintsov
Hi! I've tweaked my code few times, trying to make it simpler: got rid of some closure calls and left only one dynamic module load at client-side. http://pastebin.com/UxyifLmx http://pastebin.com/q3Tm6Ajd http://pastebin.com/4emMDBS6 Still, it gives me headaches, because mw.loader.using( 'ext.

Re: [Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-18 Thread Dmitriy Sintsov
On 18.03.2012 18:26, Dmitriy Sintsov wrote: replaced 'new MarkerController(...)' calls to 'new mw.jqgmap.MarkerController(...)' calls left from incomplete refactoring of early working (non-broken) revision, however refactored separate view / edit modules code still does not work, with the same

[Wikitech-l] Using prototypical inheritance in dynamically loaded ResourceLoader modules

2012-03-18 Thread Dmitriy Sintsov
Hi! Can a JavaScript / ResourceLoader guru explain what's wrong with my code? Module definitions at server side: http://pastebin.com/8cmRbNxe modules are loaded correctly by the following code: http://pastebin.com/MFWk6znv It is checked many times during extension development, 'localBasePath' a