On Fri, Feb 17, 2012 at 11:50 AM, khs4473 <[email protected]> wrote:

> module.exports = ? is an idiom that a large chunk of Node modules use.
>  I'll disagree with Dean and opine that this usage is indeed common



Apologies -- I definitely misspoke. I meant to emphasize that it's uses are
idiomatic to node. It doesn't matter how often module.exports is used, it's
a node idiom and not likely to be confused with usage of `module` in its
reserved context. The other uses are far less common but no less idioms.

And I can't really imagine a case where module.exports would ever occur in
the same file as the es6 module keyword (but perhaps I'm not being creative
enough). But it should be obvious when you're using the "module" free
variable vs. the module keyword.



> , but I have no data to back that up.  "module" as a function is also used
> in the jquery unit tests.
>
> If it's a "context-sensitive keyword", should these forms work as before?
>
> module(...)
> module.someName
>
>
> In order to have unambiguous syntax it looks like '{' will have to be on
> the same line, ala return?
>
> module [no line terminator here] {
>
>
> The double-use of such an important keyword is unfortunate, but it looks
> doable.  I think "package" would make a good choice as well, and it's use
> in Java doesn't bother me a bit.  But then Node dev's use "package" to mean
> something different again.
>

I agree -- the prevalence of package.json dooms this package a viable
alternative. No bother, module should be fine.


> Regardless, I think we need to think carefully about how the Node.js
> ecosystem will migrate to ES6 modules.  It seems likely that for a certain
> period, ES6 Node modules will need to interoperate with pre-ES6 modules.
>  How will that work?
>

That's a good question. If contextually reserved I don't see why it there
should be any technical limitation. The only real problem is potential
confusion -- my position is that because node's usage of module is very
narrow so this won't be a problem at all.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to