On 14.04.2011 11:38, Irakli Gozalishvili wrote:
Hi,
I just noticed that harmony modules have a different spelling then it
used to have:
module YUI ='http://developer.yahoo.com/modules/yui3.js';
module YUI = require('http://developer.yahoo.com/modules/yui3.js');
I wanted to know what was a reason for such a change. I am also
concerned that this will bring quite a confusion as `require` is
pretty well adopted function this days while spelling of it's modules
is pretty much different.
Agreed on "breaking the web" for the "require" name which already
actively used today. Though, this name is used mostly exactly for the
reason it's planned -- e.g. in CommonJS (and similar) for loading modules.
However, we shouldn't exclude that the "require" can already be used for
many other things which will break them (if not, why did we cancel "fun"
and "fn" in respect of # for short functions notations? -- IIRC, exactly
the reason "fun" / "fn" can already be used as normal identifiers. The
same with "require").
I also raised recently this question (moreover, Dave (and me in my
future presentation) used in his ES.next talk exactly first approach,
without "require"). The answer was -- to support things such as:
import (require "./modules/widgets.js").{Panel, Window}
and that string literal is ambiguous with assignment a string to a
module, which IMO not a sound reason at all.
So I also think that just string literal is enough, and it won't "break
the web" in respect of "require" identifier. Moreover, this looks for me
absolutely OK and even more convenient:
import "./modules/widgets.js".{Panel, Window}
P.S.: other variants which I proposed for such a loading:
import {Panel, Window} "./modules/widgets.js"
though, "from" keyword is asking to be included:
import {Panel, Window} from "./modules/widgets.js"
Dmitry.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss