States of object is not maintained when multiple instances of a class are created

REQUIRED INFORMATION

Ext version tested:

Ext 4.1.1

Browser versions tested against:

Any

DOCTYPE tested against:

n/a

Description:

I ran into an issue that took quite some time to debug in our application. I have isolated it to the fact that when one creates 2 instances of a class the state of the first instance is lost and replaced by the state of the second one. This is happening when the class is defined by passing a function instead of an object as the second parameter to Ext.define as documented in extjs-4.1.1/docs/index.html#!/api/Ext-method-define

I have reproduced it with the simple class below

Steps to reproduce the problem:

try code below

you will see that when the second instance is created the name property in the first instance takes the value of the one in the second instance

hold on...

Mitchell,

If it is not a bug, here are some additional questions/comments:

1) I would think the doc needs to be made clearer (http://docs.sencha.com/ext-js/4-1/#!...-method-define). In particular, the example provided gives the impression that passing a function is equivalent to passing an object literal but simply provides a mechanism to make properties/functions private.

2) Then, what is the official/supported technique to have private properties/functions?