A.) module.provide (Wes Garland)
B.) module.load (KHS)
C.) require.ensure (Wes Garland)
D.) require.load
E.) define (James Burke, Kevin H Smith)
This issue is not orthogonal to "Dynamic Require API - Unification of
Require and Provide." Please comment on that thread.
Current show of hands. Please copy and update this block in responses.
A.) -1 Christoph Dorn
B.) -1 Christoph Dorn
C.)
D.)
E.) +1 Kris Kowal
Christoph Dorn on A and B: "module" is misleading here as the "module"
instance within a Modules/1.1 module has nothing to do with it.
Christoph Dorn on C: [require.ensure] asks "require" to load a module
+ require()-linked dependencies into the current sandbox and respects
module relative and top-level module IDs.
Kris Kowal
F.) require([], function(){}) James Burke
Adding F instead of using E for the reasons I state in "Dynamic
Require API - Unification of Require and Provide."
F.) +1 James Burke
James
F has the disadvantage of advancing the responsibilities of an
existing function, meaning that new code in old implementations will
raise strange and confusing errors.
I'm for the use of "require" as a name-space since it can be carried
by fresh require properties in "Invocation Form C".
Let's re-factor the vote, between the two issues of namespace and name.
Namespace:
A.) None Kris Kowal +1, Mikael Rodgers +1, James Burke +1
B.) module Christoph Dorn -1, Kris Kowal -1
C.) require Kris Kowal +1
Name:
Z.) provide Kris Kowal -1
Y.) load Kris Kowal +1
X.) ensure Kris Kowal -1
W.) define Kris Kowal -1, James Burke -1, Christoph Dorn -1
V.) require James Burke +1 Kris Kowal -1
The votes agains "W" I carried over from "Unification of Require and Provide"
Kris Kowal
Namespace:
A.) None Kris Kowal +1, Mikael Rodgers +1, James Burke +1
B.) module Christoph Dorn -1, Kris Kowal -1, Kevin H Smith +1
C.) require Kris Kowal +1
Name:
Z.) provide Kris Kowal -1
Y.) load Kris Kowal +1, Kevin H Smith +1
(B) Seems like the wrong place for me
(A) Seems too ambiguous and does not imply ID matching equivalent to
require()
> Namespace:
> A.) None Kris Kowal +1, Mikael Rodgers +1, James Burke +1, Christoph Dorn -1
> B.) module Kris Kowal -1, Christoph Dorn -1, Kevin H Smith +1
> C.) require Kris Kowal +1, Christoph Dorn +1
>
> Name:
> Z.) provide Kris Kowal -1
> Y.) load Kris Kowal +1, Kevin H Smith +1, Christoph Dorn +1
> X.) ensure Kris Kowal -1
> W.) define Kris Kowal -1, James Burke -1, Christoph Dorn -1
> V.) require Kris Kowal -1, James Burke +1, Christoph Dorn -1
Christoph
Concurring. require and require.load are peas in a pod. I wouldn't
want to expand arguments or free-variables in this case.
Namespace:
A.) None
For: Mikeal Rodgers, James Burke
Against: Christoph Dorn
B.) module
For: Kevin H Smith
Against: Kris Kowal, Christoph Dorn
C.) require
For: Kris Kowal, Christoph Dorn
Name:
Z.) provide Kris Kowal -1
For:
Against: Kris Kowal
Y.) load
For: Kris Kowal, Kevin H Smith, Christoph Dorn
Against:
X.) ensure
For:
Against: Kris Kowal
W.) define
For:
Against: Kris Kowal, James Burke, Christoph Dorn
V.) require
For: James Burke
Against: Kris Kowal, Christoph Dorn
I don't believe that require.x will fare much better. It will generate
an error, and likely lead to the developer having to look up or ask
about the error, and I believe that most code that would use this new
API will likely want to do it as part of a module API with a factory
function (define/module.declare), so a new baseline for what is
supported by require will be there. In other words, the developer will
likely hit the "no module factory API" error before hitting this
dynamic API.
James
provide and define make absolutely no sense.
On Jan 26, 2011, at 6:41 PM, Kris Kowal wrote:
> On Wed, Jan 26, 2011 at 6:32 PM, Christoph Dorn
> <christ...@christophdorn.com> wrote:
>> Going with require.load() as ID matching semantics and scoping are the same
>> as with require() and purpose is complementary.
>
> Concurring. require and require.load are peas in a pod. I wouldn't
> want to expand arguments or free-variables in this case.
>
Namespace:
A.) None
For: Mikeal Rodgers, James Burke
Against: Christoph Dorn, Tom Robinson
B.) module
For: Kevin H Smith
Against: Kris Kowal, Christoph Dorn, Tom Robinson
C.) require
For: Kris Kowal, Christoph Dorn, Tom Robinson
Name:
Z.) provide
For:
Against: Kris Kowal, Tom Robinson
Y.) load
For: Kris Kowal, Kevin H Smith, Christoph Dorn, Tom Robinson
Against:
X.) ensure
For:
Against: Kris Kowal
W.) define
For:
Against: Kris Kowal, James Burke, Christoph Dorn, Tom Robinson
V.) require
For: James Burke
Against: Kris Kowal, Christoph Dorn, Tom Robinson
I'm a bit torn on the namespace issue. I'd love to have none but
voting "require" for the obvious pragmatical reason that it's there
already.
Namespace:
A.) None
For: Mikeal Rodgers, James Burke
Against: Christoph Dorn, Tom Robinson
B.) module
For: Kevin H Smith
Against: Kris Kowal, Christoph Dorn, Tom Robinson
C.) require
For: Kris Kowal, Christoph Dorn, Tom Robinson, Hannes Wallnoefer
Name:
Z.) provide
For:
Against: Kris Kowal, Tom Robinson
Y.) load
For: Kris Kowal, Kevin H Smith, Christoph Dorn, Tom Robinson, Hannes Wallnoefer
Against:
X.) ensure
For:
Against: Kris Kowal, Hannes Wallnoefer
W.) define
For:
Against: Kris Kowal, James Burke, Christoph Dorn, Tom Robinson,
Hannes Wallnoefer
V.) require
For: James Burke
Against: Kris Kowal, Christoph Dorn, Tom Robinson, Hannes Wallnoefer
--
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.
A.) None
For: Mikeal Rodgers, James Burke
Against: Christoph Dorn, Tom Robinson
B.) module
For: Kevin H Smith
Against: Kris Kowal, Christoph Dorn, Tom Robinson
C.) require
For: Kris Kowal, Christoph Dorn, Tom Robinson, Hannes Wallnoefer,
Irakli Gozalishvili
Name:
Z.) provide
For:
Against: Kris Kowal, Tom Robinson
Y.) load
For: Kris Kowal, Kevin H Smith, Christoph Dorn, Tom Robinson, Hannes Wallnoefer
Against:
X.) ensure
For:
Against: Kris Kowal, Hannes Wallnoefer
W.) define
For: Irakli Gozalishvili
None of the options for namespace are optimal:
That is why I think require.load() is ideal as it must follow the same
ID logic as require() with the exception that the modules may not be
available already and may need to be loaded (and it's async obviously vs
sync require()).
I would be open to require.async(). It makes less of a statement about
*loading* and emphasizes the aspect of a module not being immediately
available as opposed to the sync require().
Adding option (U).
A.) None
For: Mikeal Rodgers, James Burke
Against: Christoph Dorn, Tom Robinson
B.) module
For: Kevin H Smith
Against: Kris Kowal, Christoph Dorn, Tom Robinson
C.) require
For: Kris Kowal, Christoph Dorn, Tom Robinson, Hannes Wallnoefer,
Irakli Gozalishvili
Name:
Z.) provide
For:
Against: Kris Kowal, Tom Robinson
Y.) load
For: Kris Kowal, Kevin H Smith, Christoph Dorn, Tom Robinson, Hannes
Wallnoefer
Against:
X.) ensure
For:
Against: Kris Kowal, Hannes Wallnoefer
W.) define
For: Irakli Gozalishvili
Against: Kris Kowal, James Burke, Christoph Dorn, Tom Robinson,
Hannes Wallnoefer
V.) require
For: James Burke
Against: Kris Kowal, Christoph Dorn, Tom Robinson, Hannes Wallnoefer
U.) async
For: Christoph Dorn
Name:
For: Christoph Dorn, Tom Robinson
--
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.
That is why I think require.load() is ideal as it must follow the same ID logic as require() with the exception that the modules may not be available already and may need to be loaded (and it's async obviously vs sync require()).
I would be open to require.async(). It makes less of a statement about *loading* and emphasizes the aspect of a module not being immediately available as opposed to the sync require().
None of the options for namespace are optimal:
None: this would mean adding another free variable, which will impact
any wrappings/transport spec. Plus each free variable adds a little
bit of "noise".
Great to hear from you again; you've been missed. This approach is
certainly fine, especially if we don't find consensus elsewhere.
Kris Kowal
Right.
> you passed a require() into a sandbox that has a load method, you pass
> the sandbox the ability to use the method -- rather than just the
> ability to use the exports memo.
Right. The point is to pass in the ability to use the load method.
> I have proposed in the past that module loading be handled in the module
> namespace, with calls into the require namespace to write into the
> module memo...
I see the module namespace reserved for:
1) Keeping info about the current module (module.is, module.path)
2) Declaring a module (module.declare)
When loading modules with require.load/async() you are loading them into
the *sandbox* after which point they are available to all modules in the
sandbox.
If you need to keep the loaded modules separate you should create a new
sandbox and load the modules into that.
As for authority to load modules into the sandbox. The sandbox config
can veto what the loader can load and this works even when require is
passed off into another sandbox (the original sandbox would still have
control which is the intended behavior).
> ...i.e., I want to see require() completely decoupled from the mechanics
> of loading modules.
>
> As soon as we do that, we suddenly have another advantage: by replacing
> or adjusting the module namespace, you can implement new module,
> package, and transport formats onto an arbitrary CommonJS environment.
> This means that the rate of CommonJS growth can increase, and it can
> grow by trial/error tests, market-uptake decisions, etc -- rather than
> endless threads of bikeshedding votes.
I don't see how this would not be possible with require.load/async().
> I would be open to require.async(). It makes less of a statement
> about *loading* and emphasizes the aspect of a module not being
> immediately available as opposed to the sync require().
>
> Why does require have to be either sync or async? Will async require()
> work in sync-mode environments, or should we split the module universe
> in two?
require() assumes modules are available
require.load/async() assumes one or more modules still need to be loaded
or somehow made available by the loader in a fashion that will not
return right away but we need to know when ready.
Christoph
As for authority to load modules into the sandbox. The sandbox config can veto what the loader can load and this works even when require is passed off into another sandbox (the original sandbox would still have control which is the intended behavior).
I don't see how this would not be possible with require.load/async().This means that the rate of CommonJS growth can increase, and it can
grow by trial/error tests, market-uptake decisions, etc -- rather than
endless threads of bikeshedding votes.
require() assumes modules are availableWhy does require have to be either sync or async? Will async require()
work in sync-mode environments, or should we split the module universe
in two?
require.load/async() assumes one or more modules still need to be loaded or somehow made available by the loader in a fashion that will not return right away but we need to know when ready.
But a very important one at this foundational level. I can see uses for
this in my code today. In revisiting my thinking about the namespace it
actually makes a lot of sense to hang it off module.
It states that a module has an optional dependency on another module vs
a required dependency and this optional dependency can be traced back to
the module at any time just like static dependencies can.
> require() assumes modules are available
> require.load/async() assumes one or more modules still need to be
> loaded or somehow made available by the loader in a fashion that
> will not return right away but we need to know when ready.
>
> Is anybody prepared to discuss or specify how to implement
> require.async() on platforms which do not have an intrinsic event loop?
>
> (I have done so with module.provide but this part of the discussion has
> been approximately ignored AFAICT)
I am not prepared as I do not understand the implications and quite
frankly lack the vocabulary and experience to participate effectively.
That is why I am glad you and others who can reason at this level are on
board.
I work at a high level of abstraction most of the time and coming down
to this level of specification (including the ins and outs of
Modules/2.0) I find very taxing. That is the reason why I have not
looked at your Modules/2.0 draft in detail. I find it overwhelming in
terminology and scope. I would however like to understand the
implications and opportunities it presents to users of implementations
that follow the spec and I do believe my feedback is valuable in this area.
I am a visual thinker and it helps me a lot to see relationships in a
diagram to understand something as comprehensive as the CommonJS system
provides. I am going to take Sander's suggestion and work on a diagram
to provide an overview of Modules/2.0 and how it fits into the big
CommonJS picture.
I hope we can use such a diagram as an aid to provide context to
discussions and introduce new users to writing programs with CommonJS.
Christoph
--
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.
I am going to try and add package mappings support to BravoJS. Any
pointers before I get started?
Should it be a plugin or should I add support to the loader itself?
Christoph
FYI; Got it all working for relative 'location' mappings. Had to make a
number of changes/additions to the loader. Some more changes tomorrow
and we can discuss to fine-tune the patch and spec.
Christoph
Christoph
--
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.