[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-22 Thread buda
Hi T.J.! Thanks for your help! This code will be sheared and there is the risk that people have an ability involuntarily to change privates - so I need to protect it -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-21 Thread T.J. Crowder
Hi, On Oct 20, 3:33 am, buda www...@pochta.ru wrote: T.J. here is the example of using instance private vaiables store in use -http://jsfiddle.net/QW8vM/17/ FWIW, that code refers to an undefined symbol `_items` in the property getter function. Also note that it has a memory leak: `destroy`

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-21 Thread buda
Hi! Thanks for response. `_items` - it's typo ;) of course there mightbe - return _privates[this. internalId].items.slice(0); I agree with you about error in destroy - not deleting an instance item in _privates array. About not using such pattern - I agree if only few methods need to access

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-21 Thread T.J. Crowder
On Oct 21, 2:03 pm, buda www...@pochta.ru wrote: About not using such pattern - I agree if only few methods need to access _privates, but what if an object has about 10 or more methods that manipulate _privates!? make them all per instance? It depends entirely on how many instances you expect

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-19 Thread buda
T.J. here is the example of using instange private vaiables store in use - http://jsfiddle.net/QW8vM/13/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-19 Thread buda
T.J. here is the example of using instange private vaiables store in use - http://jsfiddle.net/QW8vM/16/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-19 Thread buda
T.J. here is the example of using instange private vaiables store in use - http://jsfiddle.net/QW8vM/17/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-19 Thread buda
T.J. here is the example of using instance private vaiables store in use - http://jsfiddle.net/QW8vM/17/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread T.J. Crowder
On Oct 18, 6:01 am, buda www...@pochta.ru wrote: here the code http://jsfiddle.net/QW8vM/10/ `Object.clone` returns a raw object with a shallow copy of the properties of the object you give it. It is not a perfect copy of the object down to the prototype level: var a, b; a = [1, 2, 3]; b =

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread buda
it's general example for show the problem with Object.clone :) Usually I use anothe technique: var a = Class.create((function(){. var instancePrivates = []; function initialize(){ var internalId; instancePrivates.push({}); internalId = --instancePrivates;

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread buda
in last example of course this.internalId = --instancePrivates; instead of var internalId; internalId = --instancePrivates; -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread buda
that sample was to demonstarte Object.clone bug :) Usually I us to var a = Class.create((function() { var _privates = []; function initialize() { _privates.push({}); this.internalId = _privates.length-1; _privates[this.internalId].items = []; -- here the instances

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread T.J. Crowder
On Oct 18, 10:29 am, buda www...@pochta.ru wrote: that sample was to demonstarte Object.clone bug :) It's not a bug, though I'd say detecting that it's being fed an array wouldn't be a bad feature to add. Usually I us to var a  = Class.create((function() {    var _privates = [];    

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread buda
I use destroy method on the class and clean everythig in it On 18 окт, 14:17, T.J. Crowder t...@crowdersoftware.com wrote: On Oct 18, 10:29 am, buda www...@pochta.ru wrote: that sample was to demonstarte Object.clone bug :) It's not a bug, though I'd say detecting that it's being fed an

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-17 Thread T.J. Crowder
Hi, The code you've quoted has a variety of syntax errors and typos, such as using `function initialize()` within an object literal (which results in an Unexpected identifier error) and using `Class.Create` rather than `Class.create`. It's very hard to help when the code presented is

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-17 Thread T.J. Crowder
On Oct 17, 10:17 am, T.J. Crowder t...@crowdersoftware.com wrote: It's very hard to help when the code presented is fundamentally broken and yet reported as working. Sorry, in print that comes across much more harshly than it was intended to. I only mean that it's easier to help debug code

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-17 Thread buda
it's ok T.J. - I'll try to write a test on JS Bin and write link here to reproduce the bug On 17 окт, 12:33, T.J. Crowder t...@crowdersoftware.com wrote: On Oct 17, 10:17 am, T.J. Crowder t...@crowdersoftware.com wrote: It's very hard to help when the code presented is fundamentally broken

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-17 Thread buda
Here is a sample from my code http://jsfiddle.net/QW8vM/9/ On 17 окт, 12:33, T.J. Crowder t...@crowdersoftware.com wrote: On Oct 17, 10:17 am, T.J. Crowder t...@crowdersoftware.com wrote: It's very hard to help when the code presented is fundamentally broken and yet reported as working.

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-17 Thread buda
sorry - this is a write link http://jsfiddle.net/QW8vM/10/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/3QhVzBt2bpUJ. To post to

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-17 Thread buda
here the code http://jsfiddle.net/QW8vM/10/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/NzCfXch19G8J. To post to this group,