Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#9407 closed defect (wontfix)

dojo.declare: allow creating constructors not bound to global module name

Reported by: James Burke Owned by: James Burke
Priority: high Milestone: future
Component: Core Version: 1.3.0
Keywords: Cc:
Blocked By: Blocking:

Description

In ServerJS land: https://developer.mozilla.org/ServerJS

there is a desire to allow creating object constructors that do not bind to a global module name. We should allow dojo.declare() to just create the constructor without doing the module binding to a name.

Attachments (1)

9407.patch (2.0 KB) - added by James Burke 10 years ago.
Possible patch

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by James Burke

Attachment: 9407.patch added

Possible patch

comment:1 Changed 10 years ago by James Burke

Milestone: 1.4future
Resolution: wontfix
Status: newclosed

Attached a patch, but this causes a problem for the declaredClass property. It uses className.

declaredClass is used by dijit to create instance IDs, uses it to do a getObject to get default attributes.

dojo.NodeList?'s instantiate method uses it to create instances. This anonymous constructor functionality would not be used likely with NodeList?.instantiate, but the widget implications are a little bit more troublesome.

In general it is nice to be able to use a string name for a module/constructor -- it means you do not have to know the name beforehand and allows dynamic code loading. So I'll close this as wontfix.

comment:2 Changed 10 years ago by Eugene Lazutkin

FYI: dojox.lang.oo.declare is a faster experimental drop-in replacement for dojo.declare. It implements the *subj* already --- see the inline documentation at the end of the file. The real purpose of this version was to fix numerous bugs in the existing implementation (e.g., this,inherited() doesn't work sometimes depending on numerous factors). It is suitably complete --- I was able to replace declare.js and run Dijit tests without any noticeable problems.

comment:3 Changed 10 years ago by Eugene Lazutkin

I forgot to add the link to the source code: http://bugs.dojotoolkit.org/browser/dojox/trunk/lang/oo/declare.js

Note: See TracTickets for help on using tickets.