Transport & Packages

47 views
Skip to first unread message

Charles Jolley

unread,
Mar 24, 2010, 12:56:01 PM3/24/10
to comm...@googlegroups.com
Hi all,

Really glad to see progress happening on the transport standard. One piece I see missing here is any accommodation for packages.

The problem is that when packages come into play you may actually have the same moduleId appear in multiple packages at once. You could also potentially load multiple versions of the same package. Hence, simply defining modules based on their moduleId alone is insufficient.

I think we need to address this somehow in the Transport API in a way that can optionally implemented.

For reference, I did implement a solution for this in the Tiki loader (http://github.com/sproutit/tiki). In tiki moduleIds can optionally also include the packageId, separated by a colon. For example, the "html" module from the "markdown" package would be registered like this:

require.def('markdown:html', { ... })

I also support an additional API to register information about a package itself including dependent scripts, etc. so the first time you try to require a module from the package, tiki can know where to go load the asset.

-Charles

James Burke

unread,
Mar 24, 2010, 1:39:40 PM3/24/10
to comm...@googlegroups.com
On Wed, Mar 24, 2010 at 9:56 AM, Charles Jolley <cha...@sproutit.com> wrote:

> require.def('markdown:html', { ... })

Why not just require.def('markdown/html', {....})? The package name
can be a top level namespace separator.

James

Irakli Gozalishvili

unread,
Mar 24, 2010, 1:44:34 PM3/24/10
to comm...@googlegroups.com
I would also support require("markdown:html") as an alternative to require("html", "markdown") proposed by require2
--
Irakli Gozalishvili
Web: http://rfobic.wordpress.com/
Phone: +31 614 205275
Address: Taksteeg 3 - 4, 1012PB Amsterdam, Netherlands



--
You received this message because you are subscribed to the Google Groups "CommonJS" group.
To post to this group, send email to comm...@googlegroups.com.
To unsubscribe from this group, send email to commonjs+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/commonjs?hl=en.


Charles Jolley

unread,
Mar 24, 2010, 1:55:35 PM3/24/10
to comm...@googlegroups.com
Because 'markdown/html' could mean either the 'markdown/html' module or the 'html' module in the 'markdown' package. You can't disambiguate between the two. This is why we need a different separator (like ':')

-C

Irakli Gozalishvili

unread,
Mar 24, 2010, 3:24:18 PM3/24/10
to comm...@googlegroups.com
I hope we won't see def2 as opposite here as well!

--
Irakli Gozalishvili
Web: http://rfobic.wordpress.com/
Phone: +31 614 205275
Address: Taksteeg 3 - 4, 1012PB Amsterdam, Netherlands


Kris Kowal

unread,
Mar 24, 2010, 3:29:14 PM3/24/10
to comm...@googlegroups.com
On Wed, Mar 24, 2010 at 10:55 AM, Charles Jolley <cha...@sproutit.com> wrote:
> Because 'markdown/html' could mean either the 'markdown/html' module or the 'html' module in the 'markdown' package.  You can't disambiguate between the two.  This is why we need a different separator (like ':')

We'll get in trouble with module name spaces that are extended to
accept arbitrary URL's, since colon indicates a URL schema. I
wouldn't want to preclude this.

Charles, I agree we need an extension for packages, but CommonJS
hasn't even agreed on a coupling for packaging and require, so I think
this is premature. I think there are ample options for this in a
future revision. Can we table this until we have as much as we've
argued about so far locked down?

Kris Kowal

Christoph Dorn

unread,
Mar 24, 2010, 3:53:06 PM3/24/10
to comm...@googlegroups.com
Charles Jolley wrote:
> Because 'markdown/html' could mean either the 'markdown/html' module or the 'html' module in the 'markdown' package. You can't disambiguate between the two. This is why we need a different separator (like ':')


I have been meaning to bring up the packages issue with the transport
proposal. Without having considered it in more detail I like:

<packageID>:<moduleID>

as suggested.

Christoph


Reply all
Reply to author
Forward
0 new messages