incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Mueller <pmue...@gmail.com>
Subject Re: Unified phonegap javascript layer incorperating modules / plugins
Date Sat, 19 Nov 2011 12:52:16 GMT
On Fri, Nov 18, 2011 at 12:59, Andrew Lunny <alunny@gmail.com> wrote:
>...
> James also wrote a post a couple of days ago defending AMD as still the
> best pragmatic choice for client-side devs:
> http://tagneto.blogspot.com/2011/11/why-not-amd.html
>...

Would some of the pro-AMD folks point to AMD specifications that we
would implement to, and point to AMD implementations that we might
reuse?

The AMD spec, as near as I can tell, is here:
https://github.com/amdjs/amdjs-api/wiki/AMD .  Is there something
else?

As a con-AMD folk, all I really have to point to for the
Node/CommonJS-style modules is the Node documentation/implementation.
modjewel (used by weinre) pretty much follows CommonJS standards, but
I think Node's module semantics are nicer.  The path search mechanism
based on convention(node_modules, package.json, et al) I think works
out better than having to deal with CommonJS path configuration
(require.paths, or whatever).

The reason I'm asking for AMD specs is because I don't know what the
expectation is beyond implementing a define() function.  For instance,
what are the specs for the require() function which you can request be
passed into your module factory?  Likewise, what is the shape of
"module"?

When using define(), would we be forced to pass the module id as the
first parameter, or alternatively, be forced NOT to pass the module
id, or does it work either way?  If you imagine collecting AMD modules
to put in a single concatenated script for production, you obviously
need the module id's in there.  Does the runtime or some tool rewrite
my modules and add the module id if I don't use one?

Is it ok to not use the pre-reqs bit?  I actually prefer a literal
require() invocation in my code, and don't feel like spending my time
keeping pre-req names in an array in a function parameter, and pre-req
variables in parameters lined up.  It's never been clear to me if
*not* using pre-reqs is ok.  Seemed like the story was if you didn't
use pre-reqs, the module would be scanned for require() statements.
Will we support that?

-- 
Patrick Mueller
http://muellerware.org

Mime
View raw message