Re: Could delete methods rename to remove?

2013-12-18 Thread Shijun He
On Wed, Dec 18, 2013 at 1:55 PM, Rick Waldron waldron.r...@gmail.comwrote: Submit patches—libraries intended for use in IE8 should be made to support that platform, it's that simple. Submitting patches is irrelevant and impractical here. Why use es5-shim? Because we want to use some scripts

Re: About Array.of()

2013-12-18 Thread Shijun He
This is an old thread which I like to mention again. The proposal is change the method name from Array.of() to Array.fromElements() to make it clear especially for non-English native programmers. It seems the thread is totally ignored... On Tue, Aug 28, 2012 at 5:56 PM, Jussi Kalliokoski

Re: About Array.of()

2013-12-18 Thread Shijun He
On Thu, Dec 19, 2013 at 4:04 AM, Benjamin (Inglor) Gruenbaum ing...@gmail.com wrote: Array.of sounds expressive only for native speakers. English is not my first language and it sounded expressive to me. I've asked 5 random friends that code and they all said it sounded fine to them. While

Re: About Array.of()

2013-12-18 Thread Shijun He
On Thu, Dec 19, 2013 at 4:37 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Dec 18, 2013, at 11:01 AM, Shijun He wrote: ... 2) In fact such expressive is MEANINGLESS because we will never write `var a = Array.of(1, 2, 3)` instead of `var a = [1, 2, 3]` Note that 'of' works

Could delete methods rename to remove?

2013-12-17 Thread Shijun He
There are some methods using reserved word delete, such as Map.prototype.delete, Set.prototype.delete... Though it is allowed since ES5, I think we'd better avoid it because it cause es6 shim solution fail on legacy browsers such as IE8. -- hax ___

Re: Could delete methods rename to remove?

2013-12-17 Thread Shijun He
...@gmail.com wrote: Le 17/12/2013 10:19, Shijun He a écrit : There are some methods using reserved word delete, such as Map.prototype.delete, Set.prototype.delete... Though it is allowed since ES5, I think we'd better avoid it because it cause es6 shim solution fail on legacy browsers such as IE8

Re: Could delete methods rename to remove?

2013-12-17 Thread Shijun He
On Wed, Dec 18, 2013 at 11:30 AM, Rick Waldron waldron.r...@gmail.comwrote: Right, and map[delete](key) works fine. The future of the language itself should not be impaired by a browser that has an expiration date. No, it does NOT work. Because you can't ask all module/library authors write

Re: Could delete methods rename to remove?

2013-12-17 Thread Shijun He
On Wed, Dec 18, 2013 at 11:28 AM, Alex Kocharin a...@kocharin.ru wrote: How can you migrate to ES6 if you didn't even migrate to ES5 first? Even IE5 (pre-ES3) can use string.prototype.repeat with simple shim. And with es6 shim, Map/Set SHOULD works on IE5, and all modules depend on Map/Set

Re: Modules, Concatenation, and Better Solutions

2012-10-19 Thread Shijun He
On Wed, Oct 17, 2012 at 10:10 AM, David Herman dher...@mozilla.com wrote: Concrete example: Even and Odd modules refer to each other, but the import statements occur after some initialization: module Odd { export let odd = function(x) { return x === 0 ? false :

Re: State of discussion - module / Import syntax

2012-10-07 Thread Shijun He
On Tue, Sep 25, 2012 at 1:02 AM, Jussi Kalliokoski jussi.kallioko...@gmail.com wrote: I find this interesting as well, because I've been thinking of creating Yet Another(TM) module loader, which would be a standalone polyfill for Harmony modules. I just wrote one:

Re: export questions

2012-09-03 Thread Shijun He
On Fri, Aug 31, 2012 at 6:24 PM, 程劭非 csf...@gmail.com wrote: What does it look like if you want to import more than one variables from one module? import {a,b} from oldscript.js#a,b 2012/8/31 Shijun He hax@gmail.com: On Fri, Aug 31, 2012 at 3:16 PM, 程劭非 csf...@gmail.com wrote: I guess

Re: export questions

2012-08-31 Thread Shijun He
On Fri, Aug 31, 2012 at 3:16 PM, 程劭非 csf...@gmail.com wrote: I guess Kevin has some same concerns with me. The four things point to one question: What should we do with the old ES3/ES5 libraries after we have module? (please correct me if you didn't mean that.) ES3/ES5 libraries might be in

Re: A question about Loader baseURL

2012-08-28 Thread Shijun He
On Tue, Aug 28, 2012 at 7:44 PM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: As I understand, imports in a/a.js (what in this case also import another 'a/a.js' which should be resolve to 'a/a/a.js') will also delegate to myLoader, Exactly. so it is obviously wrong if myFetch is invoked

Re: A question about Loader baseURL

2012-08-28 Thread Shijun He
For load('a/a.js') in my.js, myFetch is invoked with: relURL='a/a.js' baseURL = System.baseURL = '/path/my.js' For import x from 'a/a.js', myFetch is also invoked with: relURL='a/a.js' baseURL = System.baseURL = '/path/my.js' typo, both System.baseURL should read as myLoader.baserURL

Function declaration in labelled statements

2012-08-28 Thread Shijun He
ES5 strict mode disallow Function declaration in any statements. It's fine, but Function declaration in top labelled statements seems harmless, why not relax the rules to allow them so we can use Labeled Modules Specification ? Though it seems too late to fix. Code example: 'use strict' // cause

Re: A question about module/imports/exports

2012-08-27 Thread Shijun He
On Mon, Aug 27, 2012 at 2:11 PM, Luke Hoban lu...@microsoft.com wrote: And is there any difference if module A is write as: module A { var _a = 'a' export function changeA(v) { a = v } export {a: _a} } This should not work. There is no value in scope inside the module 'A'

Re: A question about module/imports/exports

2012-08-27 Thread Shijun He
On Mon, Aug 27, 2012 at 5:55 PM, Andreas Rossberg rossb...@google.com wrote: No, Luke just meant that the assignment in changeA should read _a = v Oh, my typo! since that is the local name of the variable. After changing that, the module is indeed equivalent to the other version.

A question about Loader baseURL

2012-08-27 Thread Shijun He
It seems current loader spec is so simple and I'm full of confusion of baseURL props. // lib/a.js System.baseURL // lib/a.js ?? System.load('b.js', ...) // I suppose this should load lib/b.js, right? var myLoader = new Loader(System, { baseURL: 'mypath/c.js' , fetch:myFetch })

Re: A question about Loader baseURL

2012-08-27 Thread Shijun He
On Mon, Aug 27, 2012 at 8:10 PM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: System.baseURL // lib/a.js ?? No, the base url will be an absolute URL, like 'http://example.com/lib/a.js'. So in /lib/b.js , System.baseURL will return a diff result http://example.com/lib/b.js; ? var myLoader =

Re: A question about Loader baseURL

2012-08-27 Thread Shijun He
On Mon, Aug 27, 2012 at 10:14 PM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: So in /lib/b.js , System.baseURL will return a diff result http://example.com/lib/b.js; ? This depends on how you're loading b.js. Could explain more about that? I suppose b.js is loaded by system loader. I

Re: About Array.of()

2012-08-27 Thread Shijun He
On Tue, Aug 28, 2012 at 1:55 AM, Rick Waldron waldron.r...@gmail.com wrote: I don't think that screenshots of search suggestions for a language feature that hasn't even been published is valid argument in this discussion. I'd also argue that these results support the current Array.of

Re: About Array.of()

2012-08-27 Thread Shijun He
On Tue, Aug 28, 2012 at 4:38 AM, Rick Waldron waldron.r...@gmail.com wrote: Regardless of its repositioning on the right as a property, I would intuitively expect new to behave the same way it would as its operator equivalent (for all constructors, not just Array). By no means do I wish to I

Re: A question about Loader baseURL

2012-08-27 Thread Shijun He
Example: == my.js == var myLoader = new Loader(System, {fetch: myFetch} function myFetch(relURL, baseURL, ...) {...} myLoader.load('a/a.js', ...) == a/a.js == import x from 'a/a.js' // developer means to load a/a/a.js ... As I understand, imports in a/a.js (what in this case also import

About Array.of()

2012-08-26 Thread Shijun He
Hi, I don't think Array.of() is useful, just stick on array literal seems enough: var a = [1,2,3] var a1 = [3] Why we need this: var a = Array.of(1,2,3) var a1 = Array.of(3) Is there any special benefit I missed? And there is another reason why I don't like Array.of() , myself write a small

Re: About Array.of()

2012-08-26 Thread Shijun He
On Sun, Aug 26, 2012 at 7:14 PM, Rick Waldron waldron.r...@gmail.com wrote: var o = (function( construct, ...rest ) { return new construct( rest ); })( factory [, variable arity args] ); If factory is Array and only one numeric arg is given, inline like this: var o = (function(

A question about module/imports/exports

2012-08-26 Thread Shijun He
Hi, I'm writing a library for ES5 to add module system like ES6, I just want to confirm some behaviors of ES6 module system: module A { export var a = 'a' export function changeA(v) { a = v } } module B { import * from A console.log(a) // 'a' changeA('a1') console.log(a) //