I know of exactly one language that has this: LiveScript. And although
it's convenient, I hardly need it in other languages, because I wrote
a series of snippets for JS, and my editor came with one for
CoffeeScript. Also, in LiveScript, it infers the identifier name from
the module name, but to be honest, I don't really miss it in other
languages. LiveScript is also so full of sugar and various shorthands
that there's talk of maybe removing some of it. Snippets and macros
make the shorthand kinda irrelevant. And if you're using an IDE, you
probably have a similar set of snippets that already exists, if it
supports ES6 modules.
I honestly don't see the large gain to be had from this.
```ls
# LiveScript shorthand
require! {
fs
'3d-is-cool'
}
# Equivalent using `require`
fs = require 'fs'
3dIsCool = require '3d-is-cool'
```
```js
// Equivalent in JS
import * as fs from 'fs'
import * as 3dIsCool from '3d-is-cool'
```
Isiah Meadows
[email protected]
On Tue, Jan 26, 2016 at 3:45 PM, Paul Tyng <[email protected]> wrote:
> No it does not compete with the string literal version (see my proposal, no
> quotes), its an identifier only. 3d-is-cool is not a valid identifier so
> couldn't work, neither would es6-shim.
>
> On Tue, Jan 26, 2016 at 3:44 PM Jordan Harband <[email protected]> wrote:
>>
>> also, would identifier would `import '3d-is-cool';` create?
>>
>> On Tue, Jan 26, 2016 at 12:43 PM, Jordan Harband <[email protected]> wrote:
>>>
>>> That is currently valid syntax for a module that has no exports - ie, a
>>> module for which you're relying solely on side effects. One popular usage is
>>> `import 'es6-shim';` for example.
>>>
>>> On Tue, Jan 26, 2016 at 12:31 PM, Paul Tyng <[email protected]> wrote:
>>>>
>>>> I went through the archives and existing proposals, I didn't see one
>>>> similar to this. I apologize if its been covered before. I thought that
>>>> redundant import statements could be simplified with a shorthand that works
>>>> similar to object literal notation.
>>>>
>>>> import fs;
>>>>
>>>> vs
>>>>
>>>> import fs from 'fs';
>>>>
>>>> https://github.com/paultyng/proposal-shorthand-import
>>>>
>>>> I would welcome any feedback.
>>>>
>>>> Thanks,
>>>> Paul Tyng
>>>>
>>>> _______________________________________________
>>>> es-discuss mailing list
>>>> [email protected]
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>>
>>>
>>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss