Re: set.add and set.delete return values

2012-02-14 Thread Andrea Giammarchi
typo in my line too add(key) { const map = private(this).map; return !map.has(key) !map.set(key, true); } ... On Tue, Feb 14, 2012 at 8:58 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: there is a typo in the Set delete definition, return private(this).delete(key) should be

Re: Set iterators

2012-02-14 Thread Andrea Giammarchi
Map and Set do not use an index to be accessed then the iterator send the index of the key/value as last argument ... I would say either this index is not sent at all or, since present, should be specified somehow in the spec. talking about this Map#iterate(callback:Function, context:void*):void

Re: Set constructor arguments

2012-02-14 Thread Andrea Giammarchi
thinking about the add behavior, where no duplicated values will be added, this argument may cause some logic headache anyway Set([1, 2, 1]) what should happen ? Also I would probably never use typed arrays to Set procedure ... that sounds against performances About new syntax, generators are

Re: Set iterators

2012-02-14 Thread David Bruant
Le 14/02/2012 07:22, Erik Arvidsson a écrit : On Mon, Feb 13, 2012 at 21:25, Jason Orendorff jason.orendo...@gmail.com wrote: Unless TC39 specifies otherwise, the enumeration order of Map and Set will be arbitrary, it will certainly be inconsistent across browsers, and it will most likely even

Re: Set iterators

2012-02-14 Thread Andreas Rossberg
On 14 February 2012 09:47, David Bruant bruan...@gmail.com wrote: For instance, what if Firefox and Chrome disagree, but iPhone safari and Android Webkit agree? Also, some products (Node.js (V8), MongoDB (SpiderMonkey), etc.) rely only on one JS engine, so JS code written for these could rely

Re: Set iterators

2012-02-14 Thread David Bruant
Le 14/02/2012 11:23, Andreas Rossberg a écrit : On 14 February 2012 09:47, David Bruantbruan...@gmail.com wrote: For instance, what if Firefox and Chrome disagree, but iPhone safari and Android Webkit agree? Also, some products (Node.js (V8), MongoDB (SpiderMonkey), etc.) rely only on one JS

Re: Set iterators

2012-02-14 Thread Andreas Rossberg
On 14 February 2012 12:02, David Bruant bruan...@gmail.com wrote: Le 14/02/2012 11:23, Andreas Rossberg a écrit : To be sure, this is assuming that iteration order is fixed for a given implementation. If order is not specified, then I don't see why that should be required either. It is not

Re: Native Assertion module?

2012-02-14 Thread Wes Garland
There's both room and need for a built-in assert() IMHO -- I would like one which magically compiles to nothing in production code. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Set iterators

2012-02-14 Thread Allen Wirfs-Brock
On Feb 14, 2012, at 3:45 AM, Andreas Rossberg wrote: On 14 February 2012 12:02, David Bruant bruan...@gmail.com wrote: Le 14/02/2012 11:23, Andreas Rossberg a écrit : And I see potential reasons why order might differ for separate iterations over the same collection. I'm interested in

Re: Set iterators

2012-02-14 Thread Mark S. Miller
I just happened to see http://lists.w3.org/Archives/Public/public-script-coord/2012JanMar/0157.html which shows that other web standards efforts continue to struggle to identify and quash other sources of non-determinism in web standards. If unspecified iteration order is so good, wouldn't the

Re: Set iterators

2012-02-14 Thread Andreas Rossberg
On 14 February 2012 18:15, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Feb 14, 2012, at 3:45 AM, Andreas Rossberg wrote: Dynamic changes of representation, for example. V8 does things like that all the time. And it currently goes to some length to make for-in deterministic. Good hash

Re: Set iterators

2012-02-14 Thread Allen Wirfs-Brock
On Feb 14, 2012, at 9:35 AM, Andreas Rossberg wrote: On 14 February 2012 18:15, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Feb 14, 2012, at 3:45 AM, Andreas Rossberg wrote: Dynamic changes of representation, for example. V8 does things like that all the time. And it currently goes to

Re: Set iterators

2012-02-14 Thread Jason Orendorff
On Tue, Feb 14, 2012 at 5:02 AM, David Bruant bruan...@gmail.com wrote: To be sure, this is assuming that iteration order is fixed for a given implementation. If order is not specified, then I don't see why that should be required either. It is not required, but it's what experience tells us

unsubscribe

2012-02-14 Thread Chris Marrin
- ~Chris cmar...@apple.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Native Assertion module?

2012-02-14 Thread Rick Waldron
On Tue, Feb 14, 2012 at 1:51 AM, David Herman dher...@mozilla.com wrote: On Feb 13, 2012, at 4:03 PM, Rick Waldron wrote: I speak for myself and my colleagues when I say that we've had our fill of including scripts _just_ for the sake of having a common testing interface. A reasonable

Re: Rationale behind supporting Invalid Date

2012-02-14 Thread Allen Wirfs-Brock
On Feb 12, 2012, at 3:02 PM, Brendan Eich wrote: Andrew Paprocki wrote: On Sat, Feb 11, 2012 at 8:32 PM, Brendan Eichbren...@mozilla.com wrote: It's well-specified by 15.9.3.1 etc. I was reading http://es5.github.com/x15.9.html and I see the spec for allowing NaN as the this time value.

Re: Native Assertion module?

2012-02-14 Thread John J Barton
On Tue, Feb 14, 2012 at 10:45 AM, Rick Waldron waldron.r...@gmail.com wrote: On Tue, Feb 14, 2012 at 1:51 AM, David Herman dher...@mozilla.com wrote: On Feb 13, 2012, at 4:03 PM, Rick Waldron wrote: I speak for myself and my colleagues when I say that we've had our fill of including

Re: Native Assertion module?

2012-02-14 Thread Dean Landolt
On Tue, Feb 14, 2012 at 1:50 PM, John J Barton johnjbar...@johnjbarton.comwrote: On Tue, Feb 14, 2012 at 10:45 AM, Rick Waldron waldron.r...@gmail.com wrote: On Tue, Feb 14, 2012 at 1:51 AM, David Herman dher...@mozilla.com wrote: On Feb 13, 2012, at 4:03 PM, Rick Waldron wrote:

Freezing private state (was: Rationale behind supporting Invalid Date)

2012-02-14 Thread Allen Wirfs-Brock
On Feb 12, 2012, at 1:36 PM, Mark S. Miller wrote: If the Date.prototype continues to be a valid Date object, which would be unfortunate, it should at least be a valid Date object representing an invalid unsettable date. I believe this is already what IE10 does. The invalidity isn't

Re: Set iterators

2012-02-14 Thread David Bruant
Le 14/02/2012 07:31, Mark S. Miller a écrit : [+tjclose] There are many benefits to determinism. E started with non-deterministic iteration order, which opens a covert channel hazard. I initially changed to deterministic order merely to plug this leak. Having done so, I found it had many

Re: Set constructor arguments

2012-02-14 Thread Peter Michaux
On Tue, Feb 14, 2012 at 12:09 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: thinking about the add behavior, where no duplicated values will be added, this argument may cause some logic headache anyway Set([1, 2, 1]) what should happen ? I think that should be a set with one

Re: Set iterators

2012-02-14 Thread David Bruant
Le 14/02/2012 19:28, Jason Orendorff a écrit : On Tue, Feb 14, 2012 at 5:02 AM, David Bruant bruan...@gmail.com wrote: To be sure, this is assuming that iteration order is fixed for a given implementation. If order is not specified, then I don't see why that should be required either. It is

Re: Set constructor arguments

2012-02-14 Thread Andrea Giammarchi
if you accept a single argument, of course, but what if you Set(..[1, 2, 1]) then ? magic add through Set constructor does not sound good to me On Tue, Feb 14, 2012 at 8:27 PM, Peter Michaux petermich...@gmail.comwrote: On Tue, Feb 14, 2012 at 12:09 AM, Andrea Giammarchi

Re: Set constructor arguments

2012-02-14 Thread Dean Landolt
On Tue, Feb 14, 2012 at 3:07 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: if you accept a single argument, of course, but what if you Set(..[1, 2, 1]) then ? `Set(1, 2, 1)` then? Are you suggesting this should throw? So you'd need to dedupe your arguments before you construct a

Re: Set constructor arguments

2012-02-14 Thread Andrea Giammarchi
nope, Set does not even accept arguments as it is now ... does it ? On Tue, Feb 14, 2012 at 9:20 PM, Dean Landolt d...@deanlandolt.com wrote: On Tue, Feb 14, 2012 at 3:07 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: if you accept a single argument, of course, but what if you

Re: Set length property

2012-02-14 Thread Tab Atkins Jr.
On Sun, Feb 12, 2012 at 7:08 PM, Brendan Eich bren...@mozilla.org wrote: See the thread containing Dean Landolt's dissent on 'length' being the best name: https://mail.mozilla.org/pipermail/es-discuss/2011-November/018571.html The January 19 2012 meeting notes recorded here:

Re: Set length property

2012-02-14 Thread Dean Landolt
On Tue, Feb 14, 2012 at 3:54 PM, Tab Atkins Jr. jackalm...@gmail.comwrote: On Sun, Feb 12, 2012 at 7:08 PM, Brendan Eich bren...@mozilla.org wrote: See the thread containing Dean Landolt's dissent on 'length' being the best name:

Redefine spread to use iteration? (Was: Set constructor arguments)

2012-02-14 Thread Allen Wirfs-Brock
On Feb 13, 2012, at 1:20 AM, Axel Rauschmayer wrote: True. Assuming that the spread operator works on any iterable, Not as currently specified. It does the same 0 to length generic property enumeration as is used within the Array extra functions. Changing to using an iterator probably would

Re: Set length property

2012-02-14 Thread Tab Atkins Jr.
On Tue, Feb 14, 2012 at 1:10 PM, Dean Landolt d...@deanlandolt.com wrote: On Tue, Feb 14, 2012 at 3:54 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Sun, Feb 12, 2012 at 7:08 PM, Brendan Eich bren...@mozilla.org wrote: See the thread containing Dean Landolt's dissent on 'length' being the

Re: Set length property

2012-02-14 Thread Dean Landolt
On Tue, Feb 14, 2012 at 4:20 PM, Tab Atkins Jr. jackalm...@gmail.comwrote: On Tue, Feb 14, 2012 at 1:10 PM, Dean Landolt d...@deanlandolt.com wrote: On Tue, Feb 14, 2012 at 3:54 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Sun, Feb 12, 2012 at 7:08 PM, Brendan Eich

Re: Set length property

2012-02-14 Thread Rick Waldron
On Feb 14, 2012, at 4:20 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Feb 14, 2012 at 1:10 PM, Dean Landolt d...@deanlandolt.com wrote: On Tue, Feb 14, 2012 at 3:54 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Sun, Feb 12, 2012 at 7:08 PM, Brendan Eich bren...@mozilla.org

Re: Freezing private state (was: Rationale behind supporting Invalid Date)

2012-02-14 Thread Mark S. Miller
On Tue, Feb 14, 2012 at 11:08 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Feb 12, 2012, at 1:36 PM, Mark S. Miller wrote: If the Date.prototype continues to be a valid Date object, which would be unfortunate, it should at least be a valid Date object representing an invalid

Re: Freezing private state (was: Rationale behind supporting Invalid Date)

2012-02-14 Thread Mark S. Miller
On Tue, Feb 14, 2012 at 5:48 PM, Mark S. Miller erig...@google.com wrote: named property, you can explain that all the internal property of Date.prototype is a non-configurable non-writable privately Should be ...you can explain the internal... -- Cheers, --MarkM

Re: Set length property

2012-02-14 Thread Dean Landolt
On Tue, Feb 14, 2012 at 8:14 PM, Rick Waldron waldron.r...@gmail.comwrote: On Feb 14, 2012, at 4:20 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Feb 14, 2012 at 1:10 PM, Dean Landolt d...@deanlandolt.com wrote: On Tue, Feb 14, 2012 at 3:54 PM, Tab Atkins Jr. jackalm...@gmail.com

Re: Set length property

2012-02-14 Thread Rick Waldron
On Tue, Feb 14, 2012 at 8:50 PM, Dean Landolt d...@deanlandolt.com wrote: On Tue, Feb 14, 2012 at 8:14 PM, Rick Waldron waldron.r...@gmail.comwrote: On Feb 14, 2012, at 4:20 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Feb 14, 2012 at 1:10 PM, Dean Landolt d...@deanlandolt.com

Re: Set constructor arguments

2012-02-14 Thread Mark S. Miller
On Tue, Feb 14, 2012 at 12:23 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: nope, Set does not even accept arguments as it is now ... does it ? Not now. But this thread suggests changing it to do so. I think I agree but don't yet have a strong opinion about whether Set should have

Re: Freezing private state (was: Rationale behind supporting Invalid Date)

2012-02-14 Thread Allen Wirfs-Brock
On Feb 14, 2012, at 5:48 PM, Mark S. Miller wrote: On Tue, Feb 14, 2012 at 11:08 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: My current intent is to respecify the Date time value slot as a private named property rather than as an internal property. This will enable freezing of

Re: Set length property

2012-02-14 Thread Dean Landolt
On Tue, Feb 14, 2012 at 9:17 PM, Rick Waldron waldron.r...@gmail.comwrote: On Tue, Feb 14, 2012 at 8:50 PM, Dean Landolt d...@deanlandolt.comwrote: On Tue, Feb 14, 2012 at 8:14 PM, Rick Waldron waldron.r...@gmail.comwrote: On Feb 14, 2012, at 4:20 PM, Tab Atkins Jr. jackalm...@gmail.com

Re: Set length property

2012-02-14 Thread Brendan Eich
Tab Atkins Jr. wrote: IME they're ducktyped by the presence of forEach (this is far from perfect). Length has nothing to do with iterability. What about generators? I don't want to go looking anything up right now, but I have lots of memories of things looking for the presence of length to

Re: Set length property

2012-02-14 Thread Brendan Eich
Brendan Eich wrote: Tab Atkins Jr. wrote: IME they're ducktyped by the presence of forEach (this is far from perfect). Length has nothing to do with iterability. What about generators? I don't want to go looking anything up right now, but I have lots of memories of things looking for the

Re: Set length property

2012-02-14 Thread Allen Wirfs-Brock
On Feb 14, 2012, at 6:34 PM, Mark S. Miller wrote: On Tue, Feb 14, 2012 at 1:20 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: I don't want to go looking anything up right now, but I have lots of memories of things looking for the presence of length to denote an array-like. In ES5: Many

Re: Set iterators

2012-02-14 Thread Brendan Eich
Jason Orendorff wrote: I don't think that has ever happened. Python hash codes differ from version to version and from OS to OS. Jython has a completely different hashing function from CPython, even for strings. Keep in mind that hash tables are one of two core data structures in Python, so if

Re: Set iterators

2012-02-14 Thread John Tamplin
On Tue, Feb 14, 2012 at 10:13 PM, Brendan Eich bren...@mozilla.org wrote: Is this comparable with JS? Interop on the web is a harsh mistress. The C-Python vs. IronPython vs. PyPy vs. etc. situation is more of a porting model with one-way forks. Java seems comparable, in that compiled code is

Re: Set iterators

2012-02-14 Thread Axel Rauschmayer
FWIW: I like that you can expressly opt in to ordered iteration in Java, by using LinkedHashSet (which is a subclass of HashSet which implements the interface Set): http://docs.oracle.com/javase/6/docs/api/java/util/LinkedHashSet.html On Feb 15, 2012, at 4:32 , John Tamplin wrote: On Tue,

Re: Set constructor arguments

2012-02-14 Thread Brendan Eich
+1 on ... (spread) exhausting an iterator to expand the iterated values into positional parameters or initialisers. /be Mark S. Miller wrote: On Tue, Feb 14, 2012 at 12:23 PM, Andrea Giammarchi andrea.giammar...@gmail.com mailto:andrea.giammar...@gmail.com wrote: nope, Set does not even

set.empty() method

2012-02-14 Thread Peter Michaux
If some piece of code needs to empty a set, it would be good to do that in a single call set.empty(); Otherwise we might be left doing the following which could be very inefficient. set.forEach(function(element) { set['delete'](element); }); Peter

Re: Set iterators

2012-02-14 Thread Gavin Barraclough
Perhaps I am overly fatalistic here, but if we don't specify an iteration order I think the web will just go and specify it for us, as it has for object property iteration order. We can bet against history repeating itself if we wish. On Feb 14, 2012, at 7:13 PM, Brendan Eich wrote: Mark

Re: set.empty() method

2012-02-14 Thread Brendan Eich
Good idea, but I suggest an unambiguous verb instead of an adjective-or-verb: clear. empty is often used for the predicate, in naming conventions that eschew isEmpty and emptyp patterns. /be Peter Michaux wrote: If some piece of code needs to empty a set, it would be good to do that in a

Re: Set iterators

2012-02-14 Thread Mark S. Miller
On Tue, Feb 14, 2012 at 10:05 PM, Gavin Barraclough barraclo...@apple.comwrote: [...] Mark, Do you think we want strict insertion order, including for numeric index properties? I guess I'm thinking the obvious here ( http://wiki.ecmascript.org/doku.php?id=strawman:enumeration ), but it

Re: set.empty() method

2012-02-14 Thread Mark S. Miller
clear() is ok. Also, java.util.Map and java.util.Set use clear() so it would also be familiar to many people. Perhaps deleteAll() would be more mnemonic, as its relationship with delete() would be obvious? On Tue, Feb 14, 2012 at 10:39 PM, Adam Shannon a...@ashannon.us wrote: I'd agree with

Re: set.empty() method

2012-02-14 Thread Adam Shannon
deleteAll() seems confusing because (even though sets aren't designed like this) it seems like deleteAll(key) would delete all entries that are mapped from key. On Wed, Feb 15, 2012 at 00:47, Mark S. Miller erig...@google.com wrote: clear() is ok. Also, java.util.Map and java.util.Set use