Re: @@new

2014-06-17 Thread David Herman
Your proposal is appealing but I haven't convinced myself it works. There are a couple bits I haven't quite grokked. > The special `constructor` method in ClassDeclaration/ClassExpression syntax > would desugar to a static @@new method. This class: > >class Point { >constructor(x = 0

Re: @@new

2014-06-17 Thread Tom Van Cutsem
I really like this proposal. 2014-06-17 21:32 GMT+02:00 C. Scott Ananian : > +1. > > I think you could also remove the 'construct' handler in Proxy > ( > http://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-internal-method > step 4), as the @@new method can be handled with the usual

Re: @@new

2014-06-17 Thread Jason Orendorff
On Tue, Jun 17, 2014 at 11:11 PM, Brendan Eich wrote: > I think Jason's proposal leaves this C C[Symbol.new] condition a > separate choice from everything else, and choosing the way you prefer does > not break the rest of the design. Jason? Yes, that's correct. -j __

Re: @@new

2014-06-17 Thread Brendan Eich
Kevin Smith wrote: Sorry for my previous gut reaction. This looks like a good proposal, but it makes a break with the evolutionary design of ES classes. How so? @@create or @@new, either way something in ES6 is new that was not in classes-desugared-to-functions. Furthermore, when we were ha

Re: @@new

2014-06-17 Thread Brendan Eich
Boris Zbarsky wrote: If we _can_ have a world in which web platform objects don't exist in constructed-but-not-initialized states, I personally would much prefer that +ΒΆ /be ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla

Re: @@new

2014-06-17 Thread Brendan Eich
Domenic Denicola wrote: From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Brendan Eich > See Allen's latest followup on this -- is it a static error to have both constructor and the static [Symbol.new]() method? IMO it shouldn't be, because it'd be weird to get an error

RE: exposing system time zone

2014-06-17 Thread Andrea Giammarchi
This is upside down in my opinion ... Me, as a service, would like yo notify you based on where you are. You as a user with a specific timezone in mind can always ask for it explicitly ... I'm thinking about navigations based on your location, not something easy to polifill client side only via som

Re: @@new

2014-06-17 Thread Boris Zbarsky
On 6/17/14, 8:47 PM, Allen Wirfs-Brock wrote: You mean, the already initialized checks which fall out of objects having distinct allocation and initialization functions. Those checks only occur in functions that directly access private internal state of built-in oibjects. I should note that

Re: exposing system time zone

2014-06-17 Thread Mark S. Miller
On Tue, Jun 17, 2014 at 7:27 PM, Norbert Lindenberg < ecmascr...@lindenbergsoftware.com> wrote: > The time zone the user wants to use, and therefore sets in the OS, is not > always tied to the current location. For example, on a flight from San > Francisco to Frankfurt I care about Pacific Time an

Re: exposing system time zone

2014-06-17 Thread Norbert Lindenberg
The time zone the user wants to use, and therefore sets in the OS, is not always tied to the current location. For example, on a flight from San Francisco to Frankfurt I care about Pacific Time and Central European Time, but not the other time zones I fly over. There are also locations for which

Re: exposing system time zone

2014-06-17 Thread Mark S. Miller
Even if the OS doesn't provide notifications, the implementation could poll in order to synthesize notifications. Given that the issue is time zone changes, the polling interval could be rather large without complaint, except from astronauts and east/west hyperloop travelers ;). On Tue, Jun 17, 2

Re: exposing system time zone

2014-06-17 Thread Norbert Lindenberg
On Jun 17, 2014, at 17:28 , David Herman wrote: > This was brought up on specifiction: > >http://discourse.specifiction.org/t/navigator-timezone/152 > > Does anyone know why it was left out of the first version of the Intl API? > Just for lack of time? Is it planned for the next edition?

Re: @@new

2014-06-17 Thread Kevin Smith
> > >> SyntaxError. >> >> > We could prevent this behavior by making sure that super(); must be the >> > first statement in a constructor, [...] >> >> That is what I proposed. >> > Sorry for my previous gut reaction. This looks like a good proposal, but it makes a break with the evolutionary desig

Re: exposing system time zone

2014-06-17 Thread Andrea Giammarchi
without reinventing the wheel or changing it, I think timezone is very close to geolocation so why not navigator.geolocation.getTimeZone(*success*, *error*) asd navigator.geolocation.watchTimeZone(*success*, *error*) ? On Tue, Jun 17, 2014 at 5:31 PM, Domenic Denicola < dome...@domenicdenic

Re: @@new

2014-06-17 Thread Allen Wirfs-Brock
On Jun 17, 2014, at 5:22 PM, Allen Wirfs-Brock wrote: > > On Jun 17, 2014, at 4:44 PM, Brendan Eich wrote: > >> ... especially since I missed the hideous Number special-casing spread >> around in the draft! > > could you be a bit more specific about what you are referring to? Never mind, I t

Re: exposing system time zone

2014-06-17 Thread David Herman
On Jun 17, 2014, at 5:31 PM, Domenic Denicola wrote: >> Interesting questions in that thread about what to do about time zone >> changes. An event for time zone changes seems important, but we don't >> currently have any precedent for standard library events in ECMAScript. > > Object.observe

Re: @@new

2014-06-17 Thread Jasper St. Pierre
On Tue, Jun 17, 2014 at 4:02 PM, Jason Orendorff wrote: > On Tue, Jun 17, 2014 at 2:49 PM, Jasper St. Pierre > wrote: > > How would > > > > constructor() { > > if (rand() > 0.5) > > super("A"); > > } > > > > behave? > > SyntaxError. > > > We could prevent this behavio

Re: exposing system time zone

2014-06-17 Thread Andrew Paprocki
On Tue, Jun 17, 2014 at 5:28 PM, David Herman wrote: > Does anyone know why it was left out of the first version of the Intl API? > Just for lack of time? Is it planned for the next edition? Are there tricky > issues around standardizing IANA time zones, or around incompatibilities > between diff

RE: exposing system time zone

2014-06-17 Thread Domenic Denicola
> Interesting questions in that thread about what to do about time zone > changes. An event for time zone changes seems important, but we don't > currently have any precedent for standard library events in ECMAScript. Object.observe change records? A synthetic change event seems perfect for this

exposing system time zone

2014-06-17 Thread David Herman
This was brought up on specifiction: http://discourse.specifiction.org/t/navigator-timezone/152 Does anyone know why it was left out of the first version of the Intl API? Just for lack of time? Is it planned for the next edition? Are there tricky issues around standardizing IANA time zones,

Re: @@new

2014-06-17 Thread Allen Wirfs-Brock
On Jun 17, 2014, at 4:44 PM, Brendan Eich wrote: > ... especially since I missed the hideous Number special-casing spread around > in the draft! could you be a bit more specific about what you are referring to? Allen ___ es-discuss mailing list es-di

Re: Re: ES6 modules (sorry...)

2014-06-17 Thread Adam Kircher
Mutable bindings have valid use cases for object properties as well. My - very late - vote is for modules to use the same destructuring syntax as objects. Just leave out mutable bindings in modules for now. That way both modules and objects use the same syntax and that syntax means the same th

RE: @@new

2014-06-17 Thread Domenic Denicola
From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Brendan Eich > See Allen's latest followup on this -- is it a static error to have both > constructor and the static [Symbol.new]() method? IMO it shouldn't be, because it'd be weird to get an error for `constructor` + `stat

Re: @@new

2014-06-17 Thread Jason Orendorff
On Tue, Jun 17, 2014 at 6:55 PM, Erik Arvidsson wrote: > How does this work with legacy classes? > > function B() { > this.x = 1; > } > class C extends B {} That works! `new C` desugars to `C[@@new]()`. C doesn't have a @@new method of its own, so it inherits `Function.prototype[@@new]`. The

Re: @@new

2014-06-17 Thread Erik Arvidsson
On Jun 17, 2014 7:44 PM, "Brendan Eich" wrote: > > So far, I prefer your proposal to draft ES6 by a lot -- especially since I missed the hideous Number special-casing spread around in the draft! I don't. How does this work with legacy classes? function B() { this.x = 1; } class C extends B {}

RE: @@new

2014-06-17 Thread Brian Terlson
I realized I'm not sure how my [ClassMix library]( https://gist.github.com/bterlson/fc94a81a3811f48187b6#file-mix-js) will work with this proposal, if at all. Clearly the subclass constructor in [the example](https://gist.github.com/bterlson/fc94a81a3811f48187b6#file-exampleapp-js-L15) would ha

Re: @@new

2014-06-17 Thread Brendan Eich
So far, I prefer your proposal to draft ES6 by a lot -- especially since I missed the hideous Number special-casing spread around in the draft! Jason Orendorff wrote: > Is `C === C[@@new]`? Good question. I think calling `C(...args)` should be the same as calling `new C(...args)`. How best t

Re: @@new

2014-06-17 Thread Allen Wirfs-Brock
On Jun 17, 2014, at 1:02 PM, Jason Orendorff wrote: > On Tue, Jun 17, 2014 at 2:49 PM, Jasper St. Pierre > wrote: >> How would >> >>constructor() { >>if (rand() > 0.5) >>super("A"); >>} >> >> behave? > > SyntaxError. > >> We could prevent this behavior by making s

Re: @@new

2014-06-17 Thread Kevin Smith
> > > > constructor() { > > if (rand() > 0.5) > > super("A"); > > } > > > > behave? > > SyntaxError. > > > We could prevent this behavior by making sure that super(); must be the > > first statement in a constructor, [...] > > That is what I proposed. > Sorry, but I can

Re: @@new

2014-06-17 Thread Jason Orendorff
On Tue, Jun 17, 2014 at 4:24 PM, Dmitry Soshnikov wrote: >> Anyway --- skipping a base class constructor is not a normal thing to >> do. It shouldn't be the default. > > That's the question. I guess there could valid cases when you wanna call > parent constructor conditionally as was shown, or to

Re: Standard builtins' prototypes and toString

2014-06-17 Thread Allen Wirfs-Brock
On Jun 17, 2014, at 1:41 PM, Till Schneidereit wrote: > On Tue, Jun 17, 2014 at 6:07 PM, Mark Miller wrote: > I am happy with #b as well, though I prefer #c. I also agree with C. Scott's > interpretation of #c, to mean, appropriate degenerate value, which is > generally the zero value, but is

RE: @@new

2014-06-17 Thread Brian Terlson
I like this proposal overall. Another benefit is that your super class constructors can return objects and things will just work (I think?). I'm of the opinion that new should be required. Perhaps for `class C { }`, C is a function as if created by the expression `function () { throw('Class must

Re: @@new

2014-06-17 Thread Dmitry Soshnikov
On Tue, Jun 17, 2014 at 1:02 PM, Jason Orendorff wrote: > On Tue, Jun 17, 2014 at 2:49 PM, Jasper St. Pierre > wrote: > > How would > > > > constructor() { > > if (rand() > 0.5) > > super("A"); > > } > > > > behave? > > SyntaxError. > > Ouch.. Don't know, there are se

Re: Null iterable in for-of?

2014-06-17 Thread Allen Wirfs-Brock
On Jun 17, 2014, at 1:53 PM, Domenic Denicola wrote: >> It sounds like the the tide is swinging towards bug finding rather than >> consistency in this case. I'm fine with and and will update the spec. >> accordingly. > > The conclusion here wasn't exactly clear to me. Is it the following? >

RE: Null iterable in for-of?

2014-06-17 Thread Domenic Denicola
> It sounds like the the tide is swinging towards bug finding rather than > consistency in this case. I'm fine with and and will update the spec. > accordingly. The conclusion here wasn't exactly clear to me. Is it the following? - for-in continues to do zero iterations - for-of throws a TypeE

Re: Standard builtins' prototypes and toString

2014-06-17 Thread Till Schneidereit
On Tue, Jun 17, 2014 at 6:07 PM, Mark Miller wrote: > I am happy with #b as well, though I prefer #c. I also agree with C. > Scott's interpretation of #c, to mean, appropriate degenerate value, which > is generally the zero value, but is plausibly NaN for Date. > > Whichever experiment Nightly tr

Re: @@new

2014-06-17 Thread Jason Orendorff
On Tue, Jun 17, 2014 at 2:55 PM, Erik Arvidsson wrote: > What would `C.prototype.constructor` look like with your proposal? ES6 already achieves `C.prototype.constructor === C`, for both functions and classes, simply by defining the two properties that way (in [1] steps 6 and 7). I wouldn't chang

Re: .entries() vs. the web

2014-06-17 Thread Andrea Giammarchi
https://twitter.com/slightlylate/status/475089406957604864 Take care On Tue, Jun 17, 2014 at 11:47 AM, Alex Russell wrote: > On Tue, Jun 17, 2014 at 11:46 AM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> FWIW I think this is a non issue and "how many" should not be relevant.

Re: @@new

2014-06-17 Thread Jason Orendorff
On Tue, Jun 17, 2014 at 2:49 PM, Jasper St. Pierre wrote: > How would > > constructor() { > if (rand() > 0.5) > super("A"); > } > > behave? SyntaxError. > We could prevent this behavior by making sure that super(); must be the > first statement in a constructor, [...]

@@new

2014-06-17 Thread Erik Arvidsson
Remember that ```js class C { constructor() {} } assert(C === C.prototype.constructor); ``` What would `C.prototype.constructor` look like with your proposal? Is `C === C[@@new]`? On Tue Jun 17 2014 at 3:22:05 PM, Jason Orendorff wrote: > Allen asked me to fill out what @@new would mean. Her

Re: Why is `catch` a [reserved] keyword?

2014-06-17 Thread Dmitry Soshnikov
On Tue, Jun 17, 2014 at 12:36 PM, C. Scott Ananian wrote: > My guess would be that `catch` is reserved so that (in a future > version of JavaScript) this won't be ambiguous: > ``` > try { stuff(); } > catch(e1) { } > catch(e2) { } > ``` > > Currently JS only allows a single catch clause. FWIW:

Re: @@new

2014-06-17 Thread Jasper St. Pierre
On Tue, Jun 17, 2014 at 3:21 PM, Jason Orendorff wrote: > Allen asked me to fill out what @@new would mean. Here it is. > ... snip ... > The "super Arguments" call syntax in the ES6 drafts would be constrained to > appear only at the top of a constructor, as in Java: > > class PowerUp { >

Re: Why is `catch` a [reserved] keyword?

2014-06-17 Thread Jeff Morrison
That's a great point, thanks. On 6/17/14, 12:36 PM, C. Scott Ananian wrote: My guess would be that `catch` is reserved so that (in a future version of JavaScript) this won't be ambiguous: ``` try { stuff(); } catch(e1) { } catch(e2) { } ``` Currently JS only allows a single catch clause. But i

Re: Why is `catch` a [reserved] keyword?

2014-06-17 Thread C. Scott Ananian
My guess would be that `catch` is reserved so that (in a future version of JavaScript) this won't be ambiguous: ``` try { stuff(); } catch(e1) { } catch(e2) { } ``` Currently JS only allows a single catch clause. But if it ever grows guarded catch expressions, then you would want to add multiple

Re: @@new

2014-06-17 Thread C. Scott Ananian
+1. I think you could also remove the 'construct' handler in Proxy (http://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-internal-method step 4), as the @@new method can be handled with the usual proxy method dispatch mechanism. I'll leave it to someone who better understands Proxie

Why is `catch` a [reserved] keyword?

2014-06-17 Thread Jeff Morrison
I was just talking with a co-worker today about why it's ok for 'catch' to be a property name, but not a variable identifier. It's clear that the reasoning here is because property names aren't restricted by reserved words, but it's unclear why 'catch' must be reserved to begin with? I had alw

@@new

2014-06-17 Thread Jason Orendorff
Allen asked me to fill out what @@new would mean. Here it is. ## How `new X` works `new X(...args)` `X[@@new](...args)` ## How it works for ES5 builtin constructors `Number(value)` is specified in one section. `Number[@@new](value)` is specified in another section. To support subclassi

Re: .entries() vs. the web

2014-06-17 Thread Alex Russell
On Tue, Jun 17, 2014 at 11:46 AM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > FWIW I think this is a non issue and "how many" should not be relevant. > > If developers understand the issue, the fix is straight forward. > I wish to live in your world of unicorns and magic for in that

Re: .entries() vs. the web

2014-06-17 Thread Andrea Giammarchi
FWIW I think this is a non issue and "how many" should not be relevant. If developers understand the issue, the fix is straight forward. instead of doing this ```javascript if (obj.entries) { // do stuff with entries } else if(Array.isArray(obj)) { // do stuff with obj } ``` or this `var e

Re: .entries() vs. the web

2014-06-17 Thread Alex Russell
Right. Would love to know the size/traffic of the "number of sites" affected. On Tue, Jun 17, 2014 at 10:45 AM, Rick Waldron wrote: > > > > On Mon, Jun 16, 2014 at 11:11 PM, Brendan Eich > wrote: > >> Would .items fare better, I wonder. >> > > Or outreach to sites the break? > > Rick > > >> >

Re: .entries() vs. the web

2014-06-17 Thread Rick Waldron
On Mon, Jun 16, 2014 at 11:11 PM, Brendan Eich wrote: > Would .items fare better, I wonder. > Or outreach to sites the break? Rick > > /be > > Oliver Hunt wrote: > >> It turns out there are a number of sites (such as mobile.twitter.com < >> http://mobile.twitter.com>) that are property detect

Re: Basic set operations?

2014-06-17 Thread Hemanth H.M
Holy goodness http://www.collectionsjs.com/ On Jun 9, 2014 10:33 PM, "Tab Atkins Jr." wrote: > On Mon, Jun 9, 2014 at 8:33 AM, Erik Arvidsson > wrote: > > Most of these could just be methods of iterators and then they could be > used > > for different data structures seemlessly. > > In other wor

Re: Standard builtins' prototypes and toString

2014-06-17 Thread Mark Miller
I am happy with #b as well, though I prefer #c. I also agree with C. Scott's interpretation of #c, to mean, appropriate degenerate value, which is generally the zero value, but is plausibly NaN for Date. Whichever experiment Nightly tries first with a positive outcome, I expect that's what we'll d

Re: Standard builtins' prototypes and toString

2014-06-17 Thread C. Scott Ananian
On Tue, Jun 17, 2014 at 11:33 AM, Allen Wirfs-Brock wrote: > I'm not sure who introduced the idea that the Date.prototype should have a > "zero value", but that is inconsistent with ES3&5 where the TimeValue of > Date.prototype is NaN: > http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.5 I

Re: Standard builtins' prototypes and toString

2014-06-17 Thread Allen Wirfs-Brock
On Jun 17, 2014, at 2:10 AM, Till Schneidereit wrote: > On Thu, Jun 12, 2014 at 10:42 PM, C. Scott Ananian > wrote: > On Thu, Jun 12, 2014 at 3:56 PM, Mark S. Miller wrote: > > I like this list. I prefer #c. > > * We have previously succeeded at making previously non-generic methods > > generi

Re: ES6 modules (sorry...)

2014-06-17 Thread John Barton
I guess there is no technical argument that will convince you. Thanks for at least having the discussion, more than we got before. jjb On Mon, Jun 16, 2014 at 9:02 PM, caridy wrote: > John, there are a couple of solutions at hand that you can apply: > > 1. loader provides the right hooks for y

Re: ES6 modules (sorry...)

2014-06-17 Thread Juan Ignacio Dopazo
There are two options for prefetching dependencies without having to wait for "load" and "parse": 1) Assume none of your modules use the loader object for loading other modules, parse them during deployment and get the dependency graph. 2) Use what Guy calls a "tracer" that executes your app dur

Re: Standard builtins' prototypes and toString

2014-06-17 Thread Mark S. Miller
Trying #c on Nightly would provide us the information needed to bring #c to consensus. On Tue, Jun 17, 2014 at 2:10 AM, Till Schneidereit < t...@tillschneidereit.net> wrote: > On Thu, Jun 12, 2014 at 10:42 PM, C. Scott Ananian > wrote: > >> On Thu, Jun 12, 2014 at 3:56 PM, Mark S. Miller >> wr

Re: Standard builtins' prototypes and toString

2014-06-17 Thread Till Schneidereit
On Thu, Jun 12, 2014 at 10:42 PM, C. Scott Ananian wrote: > On Thu, Jun 12, 2014 at 3:56 PM, Mark S. Miller > wrote: > > I like this list. I prefer #c. > > * We have previously succeeded at making previously non-generic methods > > generic. I think we could get away with #c. > > * It is easier f