es-discuss Digest, Vol 96, Issue 16

Isiah Meadows impinball at gmail.com
Fri Feb 6 00:21:42 PST 2015


The current spec being worked on to resolve this problem is at
http://whatwg.github.io/loader. It's still under construction, but it's
being written with browser and Node interop in mind.

> From: John Barton <johnjbarton at google.com>
> To: Glen Huang <curvedmark at gmail.com>
> Cc: monolithed <monolithed at gmail.com>, es-discuss <es-discuss at mozilla.org>
> Date: Thu, 5 Feb 2015 07:53:47 -0800
> Subject: Re: include 'foo/index.js' or include 'foo'?
> The following solution has worked very well for us:
>
> import './foo/index.js';
> means resolve './foo/index.js' relative to the importing file.
>
> All of the rest mean look up 'foo' in the developer's mapping of names,
replacing 'foo' with a path that is then used to resolve the import.
>
> To be sure 'foo' 'foo/index' and 'foo/' would likely fail after lookup
since they don't name files.
>
> (This kind of thing cannot be "up to the host". If TC39 passes on
deciding, then developers will).
>
> jjb
>
> On Thu, Feb 5, 2015 at 5:01 AM, Glen Huang <curvedmark at gmail.com> wrote:
>>
>> I believe this is out the scope of ecmascript. It’s up to the host to
determine how the paths are resolved.
>>
>> See
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hostnormalizemodulename
>>
>>> On Feb 5, 2015, at 8:51 PM, monolithed <monolithed at gmail.com> wrote:
>>>
>>> I could not find an answer in the specification regarding the following
cases:
>>>
>>> import './foo/index.js'
>>> import 'foo/index.js'
>>> import 'foo/index'
>>> import 'foo'
>>> import 'foo/'
>>>
>>>
>>> Is there a difference?
>>>
>>> Node.js lets create an 'index.js' file, which indicates the main
include file for a directory.
>>> So if you call require('./foo'), both a 'foo.js' file as well as an
'foo/index.js' file will be considered, this goes for non-relative includes
as well.
>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
>
>
> ---------- Forwarded message ----------
> From: Andy Earnshaw <andyearnshaw at gmail.com>
> To: Frankie Bagnardi <f.bagnardi at gmail.com>
> Cc: es-discuss <es-discuss at mozilla.org>
> Date: Thu, 5 Feb 2015 18:06:49 +0000
> Subject: Re: Should `use strict` be a valid strict pragma?
>
>
> On 5 Feb 2015 15:06, "Frankie Bagnardi" <f.bagnardi at gmail.com> wrote:
> >
> > I think any issues with that are imagined.  Languages have rules, and
of the people who both know what 'use strict' does and are using es6
syntax, they're very unlikely to make the mistake.
>
> Sure, it's theoretical at this point but not unimaginable. Eventually
everyone will be using "es6 syntax", and there are plenty of blogs and
books around that explain the benefits of strict mode.
>
> > I don't see people using template literals for arbitrary strings... it
could happen but it probably won't.
>
> Not everyone, but I think it's likely that some will.  If you want to add
a variable ref to a static string, for instance, it's simpler if you don't
have to change the delimiters to back ticks. We can probably only speculate
right now.
>
> > Mathias makes a good point also, it's not strings that equal the string
'use strict', it's exactly two possible arrangements of characters.
>
> And that's obvious to us, but won't be to everyone. I'm on my phone right
now so it's hard to check, but I think you'll find more sources explaining
the directive is a string literal than you would an arrangement of
characters.
>
> My immediate reaction was that it wasn't worth it, but I kinda think that
if it is easy enough to implement then any risk would be avoided by doing
so.
>
>
>
> ---------- Forwarded message ----------
> From: Steve Fink <sphink at gmail.com>
> To: es-discuss at mozilla.org
> Cc:
> Date: Thu, 05 Feb 2015 11:20:12 -0800
> Subject: Re: Should `use strict` be a valid strict pragma?
> On 02/05/2015 05:12 AM, Andy Earnshaw wrote:
>>
>> I think you're missing the point Leon is trying to make.  He's saying
that, in ES 6 we have a new way to write strings.  In some ways, these more
powerful strings may condition some people to use ` as their main string
delimiter. An unsuspecting person may liken this to PHP's double quotes vs
single quotes, thinking that the only difference is that you can use
`${variable}` in strings that are delimited with backticks, but other than
that everything is the same.  When they write this in their code:
>>
>> ```
>> `use strict`;
>> ```
>>
>> They may introduce bugs by writing non-strict code that doesn't throw
when it should.  Adding it to the spec wouldn't be difficult and it would
avoid any potential confusion or difficult-to-debug issues.  It's
definitely easier than educating people, IMO.
>
>
> 'use strict' and "use strict" are magic tokens and should stay that way,
not propagate to other ways of writing literal strings. Literal strings are
different things, which happen to share the same syntax for
backwards-compatibility reasons.
>
> If people switch to backticks for all their literal strings, so much the
better -- then single and double quotes will only be used for directives,
and there will be less confusion. (I don't actually believe that. At the
very least, I don't expect JSON to allow backticks anytime soon. Nor do I
think that using backticks indiscriminately is good practice.)
>
>
>
>
> ---------- Forwarded message ----------
> From: Axel Rauschmayer <axel at rauschma.de>
> To: Steve Fink <sphink at gmail.com>
> Cc: es-discuss list <es-discuss at mozilla.org>
> Date: Thu, 5 Feb 2015 20:24:24 +0100
> Subject: Re: Should `use strict` be a valid strict pragma?
> Also: given that modules are implicitly strict, you will hardly ever use
the strict directive in ES6.
>
>> On 05 Feb 2015, at 20:20, Steve Fink <sphink at gmail.com> wrote:
>>
>> On 02/05/2015 05:12 AM, Andy Earnshaw wrote:
>>>
>>> I think you're missing the point Leon is trying to make.  He's saying
that, in ES 6 we have a new way to write strings.  In some ways, these more
powerful strings may condition some people to use ` as their main string
delimiter. An unsuspecting person may liken this to PHP's double quotes vs
single quotes, thinking that the only difference is that you can use
`${variable}` in strings that are delimited with backticks, but other than
that everything is the same.  When they write this in their code:
>>>
>>> ```
>>> `use strict`;
>>> ```
>>>
>>> They may introduce bugs by writing non-strict code that doesn't throw
when it should.  Adding it to the spec wouldn't be difficult and it would
avoid any potential confusion or difficult-to-debug issues.  It's
definitely easier than educating people, IMO.
>>
>>
>> 'use strict' and "use strict" are magic tokens and should stay that way,
not propagate to other ways of writing literal strings. Literal strings are
different things, which happen to share the same syntax for
backwards-compatibility reasons.
>>
>> If people switch to backticks for all their literal strings, so much the
better -- then single and double quotes will only be used for directives,
and there will be less confusion. (I don't actually believe that. At the
very least, I don't expect JSON to allow backticks anytime soon. Nor do I
think that using backticks indiscriminately is good practice.)
>
>
> --
> Dr. Axel Rauschmayer
> axel at rauschma.de
> rauschma.de
>
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150206/77baeae6/attachment-0001.html>


More information about the es-discuss mailing list