Re: Comments on Meeting Notes

2012-12-05 Thread Claude Pache
Le 4 déc. 2012 à 22:28, Brendan Eich bren...@mozilla.org a écrit : Mark S. Miller wrote: On Tue, Dec 4, 2012 at 10:48 AM, Brendan Eichbren...@mozilla.org wrote: Kevin Smith wrote: I recommend allowing let declarations only in strict mode. This is the simple, backwards-compatible path.

Re: Comments on Meeting Notes

2012-12-05 Thread Claude Pache
Le 5 déc. 2012 à 15:28, Brendan Eich bren...@mozilla.org a écrit : Claude Pache wrote: Le 4 déc. 2012 à 22:28, Brendan Eichbren...@mozilla.org a écrit : Mark S. Miller wrote: On Tue, Dec 4, 2012 at 10:48 AM, Brendan Eichbren...@mozilla.org wrote: Kevin Smith wrote: I recommend

Conditional catch clause

2012-12-19 Thread Claude Pache
Hello, In SpiderMonkey (and perhaps other JS engines?), there are conditional catch clauses: catch (exception if condition) Could such a feature added to ECMAScript? Rationale: Although try/catch mechanism was initially intended for treating errors, it could be used in normal control

Re: Conditional catch clause

2012-12-19 Thread Claude Pache
Le 19 déc. 2012 à 15:32, David Bruant bruan...@gmail.com a écrit : Le 19/12/2012 14:13, Claude Pache a écrit : Hello, In SpiderMonkey (and perhaps other JS engines?), there are conditional catch clauses: catch (exception if condition) Could such a feature added to ECMAScript

Re: Conditional catch clause

2012-12-19 Thread Claude Pache
Le 20 déc. 2012 à 00:31, John J Barton johnjbar...@johnjbarton.com a écrit : On Wed, Dec 19, 2012 at 11:23 AM, Brendan Eich bren...@mozilla.com wrote: John J Barton wrote: On Wed, Dec 19, 2012 at 8:11 AM, Brandon Benvie bran...@brandonbenvie.com mailto:bran...@brandonbenvie.com wrote:

Re: WebIDL attribute reflection

2012-12-30 Thread Claude Pache
Le 30 déc. 2012 à 19:20, David Bruant bruan...@gmail.com a écrit : Interesting point. Unrelated, but it's making me realize that innerHTML may stay a getter/setter (not sure about inherited or not). I guess the divide I'd like to put is between object state and what is conveniently put as

Re: Wildcard

2012-12-30 Thread Claude Pache
I think that nothing wins over dot or underscore for marking unused positions, for one simple reason: it is implemented for years in every engines in constructs like: var myArray = [ , , third] So it seems more natural to me to have something like: function( , , z) { /* ... */ } But anyway,

Re: 10 biggest JS pitfalls

2012-12-31 Thread Claude Pache
Le 31 déc. 2012 à 10:17, Axel Rauschmayer a...@rauschma.de a écrit : I’d be interested in other examples of implicit conversions stumping people. What stumped who, when? Any bugs/github issues/blog posts to cite? No, I think I agree with your assessment that implicit conversion to boolean

Re: 10 biggest JS pitfalls

2012-12-31 Thread Claude Pache
Le 31 déc. 2012 à 18:58, Axel Rauschmayer a...@rauschma.de a écrit : Personally, I have issues with from- and to-String conversions when working with HTML form field values and data-* attributes. More precisely, I am careful to make these conversions manually, and I regret that JS doesn't

Re: 10 biggest JS pitfalls

2012-12-31 Thread Claude Pache
I've just discovered that someone is fallen in the following pit: Change of the semantic of function declarations in Firefox when included in block (spoiler: hoisting issue). (Not standard ES for sure, but definitely JS.) Enjoy: http://statichtml.com/2011/spidermonkey-function-hoisting.html

Re: 10 biggest JS pitfalls

2013-01-06 Thread Claude Pache
On Sun, Jan 6, 2013 at 5:06 AM, Axel Rauschmayer a...@rauschma.de wrote: snip This is not about pointing out how bad JavaScript is, it is about collecting things that confuse people who are new to the language. They help those people to learn what you already know. Many people really

Re: Private Slots

2013-01-14 Thread Claude Pache
Le 14 janv. 2013 à 19:29, Kevin Smith khs4...@gmail.com a écrit : The concept of freezing the whole object is the problem. If you call `freeze` on a DOM object, does the page stop changing? Of course not -- objects can have hidden state that you, the client of that object, have no

Re: Private Slots

2013-01-14 Thread Claude Pache
—Claude Le 14 janv. 2013 à 20:46, Claude Pache claude.pa...@gmail.com a écrit : Le 14 janv. 2013 à 19:29, Kevin Smith khs4...@gmail.com a écrit : The concept of freezing the whole object is the problem. If you call `freeze` on a DOM object, does the page stop changing? Of course

Re: Private symbols as WeakMap sugar

2013-01-21 Thread Claude Pache
Le 16 janv. 2013 à 09:11, David Bruant bruan...@gmail.com a écrit : Hi, This is an idea naturally derived of all the current discussions about WeakMaps and Private symbols. The proposal is easily summarized by these lines of code: var wm = new WeakMap(); var o = {}; o[wm] =

Re: Private symbols as WeakMap sugar

2013-01-21 Thread Claude Pache
Le 21 janv. 2013 à 11:58, David Bruant bruan...@gmail.com a écrit : Le 21/01/2013 10:05, Claude Pache a écrit : Le 16 janv. 2013 à 09:11, David Bruant bruan...@gmail.com a écrit : Hi, This is an idea naturally derived of all the current discussions about WeakMaps and Private symbols

Re: Questioning WeakMap.prototype.clear

2013-01-23 Thread Claude Pache
Le 22 janv. 2013 à 22:34, David Bruant bruan...@gmail.com a écrit : Back to weakmaps, the issue here is not technical, but... cultural I would say. Indeed, the issue is cultural. We are questioning WeakMap.prototype.clear, because some people think that WeakMap should provide some strong

Re: disabling use strict; everywhere

2013-01-30 Thread Claude Pache
Le 30 janv. 2013 à 06:12, Andrea Giammarchi andrea.giammar...@gmail.com a écrit : I have a blog post about it called Resurrecting The With Statement and before I post the link, there the long story short: putting `with(this){` before any build process/inlined library and `}` at the

Re: disabling use strict; everywhere

2013-01-30 Thread Claude Pache
*/ })(); } On Wed, Jan 30, 2013 at 10:48 AM, Claude Pache claude.pa...@gmail.com wrote: Le 30 janv. 2013 à 06:12, Andrea Giammarchi andrea.giammar...@gmail.com a écrit : I have a blog post about it called Resurrecting The With Statement and before I post the link, there the long

Re: Refutable pattern

2013-02-01 Thread Claude Pache
Le 1 févr. 2013 à 20:00, Andreas Rossberg rossb...@google.com a écrit : On 1 February 2013 18:24, Brandon Benvie bran...@brandonbenvie.com wrote: A postfix '?' would require backtracking when the next '}' is found...I think? Yeah. I admit that I don't remember much of the earlier

Re: Jan 29 TC39 Meeting Notes

2013-02-08 Thread Claude Pache
Le 8 févr. 2013 à 16:00, David Bruant bruan...@gmail.com a écrit : Le 07/02/2013 18:42, Andreas Rossberg a écrit : On 7 February 2013 18:36, David Bruant bruan...@gmail.com wrote: I hardly understand the benefit of an inconditionally-throwing setter over a __proto__ as data property, but I'm

Re: Jan 29 TC39 Meeting Notes

2013-02-08 Thread Claude Pache
Le 8 févr. 2013 à 23:07, David Bruant bruan...@gmail.com a écrit : Le 08/02/2013 19:35, Allen Wirfs-Brock a écrit : On Feb 8, 2013, at 10:15 AM, Claude Pache wrote: The magic is not in the form of the '__proto__' property of the Object.prototype object, but in the action that its setter

Re: Check out Dart's iterators

2013-02-10 Thread Claude Pache
Le 10 févr. 2013 à 22:01, David Bruant bruan...@gmail.com a écrit : snip I have to note that there is a minor security hazard in code using iterators naively: import process from m; var a = [1, 2, 3, 4, 5]; var next = 0; var it = { next: function(){

Re: Check out Dart's iterators

2013-02-10 Thread Claude Pache
manually such a StopIteration with: new StopIteration(source, value) [1] http://wiki.ecmascript.org/doku.php?id=harmony:generators —Claude Claude Pache wrote: In order to mitigate the problem, instead of throwing a generic StopIteration, I think we ought to throw a specific StopIteration instance

Re: Check out Dart's iterators

2013-02-10 Thread Claude Pache
at 9:35 PM, Claude Pache claude.pa...@gmail.com wrote: Le 10 févr. 2013 à 22:01, David Bruant bruan...@gmail.com a écrit : snip I have to note that there is a minor security hazard in code using iterators naively: import process from m; var a = [1, 2, 3, 4, 5]; var next

Re: Transitioning to strict mode

2013-02-18 Thread Claude Pache
Le 18 févr. 2013 à 12:29, David Bruant bruan...@gmail.com a écrit : snip # On older browser not running strict mode I was precisely going to write that it is missing an important explicit advice to produce code that runs both under strict and non-strict mode. That point is a very valid

Re: Case insensitive String startsWith, contains, endsWith, replaceAll method

2013-02-18 Thread Claude Pache
Le 18 févr. 2013 à 00:56, Biju bijumaill...@gmail.com a écrit : On 16 February 2013 20:26, David Bruant bruan...@gmail.com wrote: Le 17/02/2013 00:58, Biju a écrit : Also, it doesn't seem that hard to implement: String.prototype.startsWithI = function(s){ this.match(new

Re: Mutable `length` for functions?

2013-02-26 Thread Claude Pache
An alternative to a writable 'length' property, is to make it configurable and nonwritable. It would prevent the issue of accidental assignments to the 'length' property that used be ignored in non-strict mode (they'll still be ignored), but it would allow to modify its value using

Re: Add intersections and unions to Set

2013-03-04 Thread Claude Pache
The Set constructor accepts an iterable (including an Array and a Set) as an argument to populate the newly-constructed Set with several values. There should also be the possibility to add or remove multiple elements of an already-constructed Set. That covers unions and differences, but it is

Re: Add intersections and unions to Set

2013-03-04 Thread Claude Pache
Le 4 mars 2013 à 23:37, Claude Pache claude.pa...@gmail.com a écrit : The Set constructor accepts an iterable (including an Array and a Set) as an argument to populate the newly-constructed Set with several values. There should also be the possibility to add or remove multiple elements

Re: On Scope And Prototype Security

2013-03-19 Thread Claude Pache
Le 19 mars 2013 à 21:53, Andrea Giammarchi andrea.giammar...@gmail.com a écrit : Is there any mechanism in any future specs that does **not** let Object.getPrototypeOf(object) return the prototype and return null instead ? Object.hidePrototypeOf(object) Object.hidePrototypeOf =

Re: Functions in ES6

2013-03-25 Thread Claude Pache
Le 25 mars 2013 à 08:28, Axel Rauschmayer a...@rauschma.de a écrit : 2. Function expressions -- arrow functions No, it depends. Roughly, I would replace function expressions by arrow functions when I want to use the 'this' binding of the enclosing scope (or don't use the 'this' binding), and

Re: What are Symbols? Objects? New primitive type?

2013-04-13 Thread Claude Pache
Le 13 avr. 2013 à 09:56, Andreas Rossberg rossb...@google.com a écrit : On 13 April 2013 00:35, Allen Wirfs-Brock al...@wirfs-brock.com wrote: snip Regarding #3 The biggest footgun is if new Symbol() creates a Symbol wrapper. However, new Symbol() returning a primitive values

Re: What are Symbols? Objects? New primitive type?

2013-04-13 Thread Claude Pache
Le 13 avr. 2013 à 15:25, Andreas Rossberg rossb...@google.com a écrit : On 13 April 2013 13:36, Claude Pache claude.pa...@gmail.com wrote: Le 13 avr. 2013 à 09:56, Andreas Rossberg rossb...@google.com a écrit : On 13 April 2013 00:35, Allen Wirfs-Brock al...@wirfs-brock.com wrote

Re: Time zone offsets for any time zone, possible change to Date functionality (i18n)

2013-04-15 Thread Claude Pache
Le 15 avr. 2013 à 09:27, Sorin Mocanu sorinmoc...@google.com a écrit : Hi Norbert, Sorry for not having better explained my suggestion. `var date = Date.withTimeZone(America/Los_Angeles, 2013, 3, 9, 15, 11, 0);` would create a Date object with a local time for America/Los_Angeles,

Syntax error for lexical declarations not directly within block

2013-04-15 Thread Claude Pache
Hi, I've noted that it is a Syntax error to write things like `if (foo) let x;` or `while (bar) let x;` (without block enclosing the `let x` statement), both in the latest version of FF and Chrome (appropriate experimental flags enabled), which is a very reasonable behaviour. However, I was

Re: Time zone offsets for any time zone, possible change to Date functionality (i18n)

2013-04-15 Thread Claude Pache
Le 15 avr. 2013 à 14:43, Dean Landolt d...@deanlandolt.com a écrit : On Sun, Apr 14, 2013 at 10:49 PM, Norbert Lindenberg ecmascr...@lindenbergsoftware.com wrote: On Apr 9, 2013, at 15:23 , Nebojša Ćirić wrote: I'll add this as a second option to the strawman. 2013/4/9

Re: Syntax error for lexical declarations not directly within block

2013-04-15 Thread Claude Pache
Le 15 avr. 2013 à 15:29, André Bargull andre.barg...@udo.edu a écrit : Statements and Declarations are separate production rules (cf. 12 Statements and Declarations in the draft), only a Statement can be nested directly within an if-Statement. - André Indeed, thanks. —Claude Hi,

Re: The Paradox of Partial Parametricity

2013-05-10 Thread Claude Pache
Le 10 mai 2013 à 14:55, Mark S. Miller erig...@google.com a écrit : [+es-discuss] I didn't realize that I composed this in reply to a message only on public-script-coord. Further discussion should occur only on es-discuss. Sorry for the confusion. On Fri, May 10, 2013 at 5:52 AM,

Re: Why can’t for-of be applied to iterators?

2013-06-12 Thread Claude Pache
Le 12 juin 2013 à 12:55, Andreas Rossberg rossb...@google.com a écrit : On 11 June 2013 21:19, Brendan Eich bren...@mozilla.com wrote: Andreas Rossberg wrote: That makes a terrible API, though. I think Axel has a valid point that the distinction between iterators and iterables is fuzzy

Re: Why can’t for-of be applied to iterators?

2013-06-12 Thread Claude Pache
Le 12 juin 2013 à 18:14, Andreas Rossberg rossb...@google.com a écrit : On 12 June 2013 14:12, Claude Pache claude.pa...@gmail.com wrote: snip On the other hand, I see a small advantage of the weird requirement for iterators to be iterables themselves: It allows to discriminate between

Re: Why can’t for-of be applied to iterators?

2013-06-12 Thread Claude Pache
Le 12 juin 2013 à 20:46, Andreas Rossberg rossb...@google.com a écrit : On 12 June 2013 19:51, Brendan Eich bren...@mozilla.com wrote: The @iterator part of the iteration protocol is not about coercion or types at all. It is a pattern for getting or creating a usable iterator from an

Re: Why can’t for-of be applied to iterators?

2013-06-13 Thread Claude Pache
Le 13 juin 2013 à 03:33, Brendan Eich bren...@mozilla.com a écrit : Andreas Rossberg wrote: On 12 June 2013 23:27, Claude Pacheclaude.pa...@gmail.com wrote: Therefore, I think that For/of coerces its argument to an iterator is a wrong mental model, and For/of accepts either a reusable

Re: Precedence of yield operator

2013-06-15 Thread Claude Pache
Le 15 juin 2013 à 10:18, François REMY francois.remy@outlook.com a écrit : I'm maybe biased, but I would love to consider yield as a function. Indeed, it calls another code, which can return you a value. That looks very similar to a function call to me. If we do this, the predecence

Re: Array.prototype.values() compatibility hazard

2013-06-19 Thread Claude Pache
I've just added a warning on the corresponding page of the MDN JavaScript Reference [1] (the last bullet of the Description section and the red box at the top of the page), so that this Reference ceases to be guilty of not warning that `with` is future-hostile. [1]

Re: Array.prototype.values() compatibility hazard

2013-06-19 Thread Claude Pache
Le 18 juin 2013 à 03:30, Brandon Benvie bben...@mozilla.com a écrit : On 6/17/2013 4:33 PM, Jason Orendorff wrote: Firefox added Array.prototype.values() and immediately ran into compatibility issues. https://bugzilla.mozilla.org/show_bug.cgi?id=883914

Re: Why does Array.from accept non-iterable arraylikes?

2013-06-26 Thread Claude Pache
Iterables are useful not only in for/of loops but also in otherwise polyfillable constructs; for example, in the Set constructor: // Let `a` be a Set object b = new Set(a) // copy the elements of `a` into a new Set Question: Will there be a standard way for obtaining the @@iterator

Re:

2013-06-28 Thread Claude Pache
Le 29 juin 2013 à 00:14, Eric Elliott e...@ericleads.com a écrit : snip I saw a recent example of one of the problems with single-ancestor inheritance in a talk. I wish I could remember which one. The illustrations were great: Animal - Walking - Monkey - Human - Flying

Re:

2013-06-29 Thread Claude Pache
even if you start out using class inheritance, it can be problematic to switch to mixins and similar strategies down the road. - Eric On Fri, Jun 28, 2013 at 7:41 PM, Claude Pache claude.pa...@gmail.com wrote: Le 29 juin 2013 à 00:14, Eric Elliott e...@ericleads.com a écrit : snip

Re: Make class constructors work with [[Call]] too?

2013-07-02 Thread Claude Pache
* `Date()` and `new Date` give different results; * It would add complexity (for the programmer) to have constructors defined the ES1-5 way and constructors defined using `class` behave differently; * Opinions differ on best practices. —Claude Le 2 juil. 2013 à 07:09, Domenic Denicola

Re: thisArg in Array#find and Array#findIndex

2013-07-10 Thread Claude Pache
Le 10 juil. 2013 à 11:26, David Bruant bruan...@gmail.com a écrit : Hi, I was wondering whether it was any useful to have the thisArg argument in Array#find and Array#findIndex. As of ES6, the language has Function.prototype.bind and arrow functions and I would imagine these to be

Re: thisArg in Array#find and Array#findIndex

2013-07-10 Thread Claude Pache
Le 10 juil. 2013 à 19:05, David Bruant bruan...@gmail.com a écrit : Who needs this particular consistency anyway? IMO, when designing an API, the right question is not: Why would I be consistent in that particular case?, but: Why would I be inconsistent in that particular case? You didn't

Re: How primitive are Symbols? Bignums? etc

2013-07-17 Thread Claude Pache
Le 17 juil. 2013 à 18:43, Andreas Rossberg rossb...@google.com a écrit : If users ignore them anyway, why would they care? If symbols are primitives with wrapper, they *must* care: They must know that `new Symbol` does not produce a new symbol, but some useless object. At least, `new

Re: How primitive are Symbols? Bignums? etc

2013-07-18 Thread Claude Pache
IIUC, the problem with symbols-as-primitives is that, on one hand, wrapper objects are not wanted, but, on the other hand, getting rid of wrappers leads to complications. My suggestion is to allow wrapper objects to exist in the spec, but to completely hide them from the user by doing an

Re: Chained comparisons from Python and CoffeeScript

2013-07-22 Thread Claude Pache
Two (or three) remarks: (1) The following expressions are perfectly reasonable, where a, b, c, d are variables holding numbers, and y is a variable (not a literal) holding a boolean: a b == y a b == c d and even (although it demands some imagination): a b

Re: Chained comparisons from Python and CoffeeScript

2013-07-22 Thread Claude Pache
Le 22 juil. 2013 à 17:55, Andy Earnshaw andyearns...@gmail.com a écrit : On Mon, Jul 22, 2013 at 2:24 PM, Claude Pache claude.pa...@gmail.com wrote: Even if we ignore the last expression, it would be surprising (for, e.g., people used to Python), if we change the meaning of `a b = y

Re: Is it really a good idea for octal numbers to allow capital-O, e.g. 0O755?

2013-07-23 Thread Claude Pache
``` var Oo22 = 60 window.alert(Oo22 - 0o22) // 42 O_o ``` Indeed, you ain't gonna need it for obfuscating your code, there's already more than one way to do it. :-) Since there won't be much code containing words starting with OO, O0, 0O or 00, the risk of eye-bleeding is low. OT0H, it would

Re: use strict 2

2013-07-24 Thread Claude Pache
I consider your first three complaints as features instead of defects, and the last one as an expert feature. The use strict directive corrected only objectively problematic misfeatures. ??Claude Le 24 juil. 2013 ?? 11:35, BelleveInvis infinte.c...@hotmail.com a ??crit : I think that we

Re: Proposal: Add functionalities to the for/of protocol that take full advantange of the generators/iterators features

2013-07-30 Thread Claude Pache
Le 30 juil. 2013 à 21:39, Andrew Fedoniouk n...@terrainformatica.com a écrit : I am not sure if it close to the problem you describe but something tells me that it is. You missed my point. I do not want to change the approach to iteration, even if it solves a problem. I am proposing

Re: Promises Consensus

2013-07-31 Thread Claude Pache
Le 31 juil. 2013 à 20:23, Tab Atkins Jr. jackalm...@gmail.com a écrit : The first issue still up for community discussion involves the definition of promise-like. We'd like the definition to be: (a) a Promise or subtype, or (b) a branded non-Promise (with the branding done via Symbol or

Re: Promises Consensus

2013-08-02 Thread Claude Pache
Le 1 août 2013 à 00:53, Claude Pache claude.pa...@gmail.com a écrit : Le 31 juil. 2013 à 20:23, Tab Atkins Jr. jackalm...@gmail.com a écrit : The first issue still up for community discussion involves the definition of promise-like. We'd like the definition to be: (a) a Promise

Re: typeof extensibility, building on my Value Objects slides from Thursday's TC39 meeting

2013-08-03 Thread Claude Pache
Le 3 août 2013 à 12:01, David Bruant bruan...@gmail.com a écrit : For both null and the new value types, I'm still unclear on why could devs would choose something different than the default. I feel the incentives can only weigh in favor of keeping the default. I'm interested in what other

Re: typeof extensibility, building on my Value Objects slides from Thursday's TC39 meeting

2013-08-03 Thread Claude Pache
Le 4 août 2013 à 01:39, Brendan Eich bren...@mozilla.com a écrit : Brendan Eich wrote: Claude Pache wrote: Fixing `typeof` of old (null) and new value types would be a solution, but I'm rather definitely considering something like the defunct `Object.isObject()` I forgot to add that my

Re: typeof extensibility, building on my Value Objects slides from Thursday's TC39 meeting

2013-08-03 Thread Claude Pache
Le 4 août 2013 à 01:34, Brendan Eich bren...@mozilla.com a écrit : Claude Pache wrote: Fixing `typeof` of old (null) and new value types would be a solution, but I'm rather definitely considering something like the defunct `Object.isObject()`. (As a side-note, I suggest `typeof uint64(0

Re: typeof extensibility, building on my Value Objects slides from Thursday's TC39 meeting

2013-08-05 Thread Claude Pache
Le 4 août 2013 à 18:23, Brendan Eich bren...@mozilla.com a écrit : You must mean by 'objectness' reference-not-value semantics -- typeof returning object or function and the user ruling out null value (or opting into null result) doesn't do a thing to reject non-extensible,

Re: typeof extensibility, building on my Value Objects slides from Thursday's TC39 meeting

2013-08-05 Thread Claude Pache
Le 5 août 2013 à 19:14, Brendan Eich bren...@mozilla.com a écrit : Claude Pache wrote: Le 4 août 2013 à 18:23, Brendan Eichbren...@mozilla.com a écrit : You must mean by 'objectness' reference-not-value semantics -- typeof returning object or function and the user ruling out null value

Re: Letting RegExp method return something iterable?

2013-08-27 Thread Claude Pache
Le 27 août 2013 à 01:23, Brendan Eich bren...@mozilla.com a écrit : Andrea Giammarchi wrote: Is it very useful because you wrote for instead of while ? ```javascript while (m = re.exec(str)) console.log(m[0]) ; ``` It is, for two reasons: 1. in JS only for can have a let or var

Re: Letting RegExp method return something iterable?

2013-08-27 Thread Claude Pache
...@gmail.com wrote: sure you know everything as soon as you read `of` ... right ? How objectives are your points ? If you know JS that while looks very simple, IMO On Tue, Aug 27, 2013 at 5:24 AM, Claude Pache claude.pa...@gmail.com wrote: Le 27 août 2013 à 01:23, Brendan Eich bren

Re: RegExp. quoteText()

2013-08-28 Thread Claude Pache
Le 28 août 2013 à 17:23, Axel Rauschmayer a...@rauschma.de a écrit : This must have been suggested before, but it would be great to have a built-in function for quoting text in a RegExp. For example: ```js RegExp.quoteText = function (text) { return

Re: `.toArray()` for all generators

2013-08-28 Thread Claude Pache
Note that an equivalent of both `.map` and `.filter` already exists in ES6: its name is generator expression. For instance: ``` array.filter(pred).map(transf) ``` becomes: ``` (for (let x of iter) if (pred(x)) transf(x)) ``` —Claude Le 28 août 2013 à 17:27, Forbes Lindesay

Re: Should the length property of bound functions be configurable

2013-08-30 Thread Claude Pache
The `uncurryThis` metafunction, given as example in [1], needs to correct the length of a function produced by `bind`. Simplified version: ``` uncurryThis = f = Function.protytpe.call.bind(f) // uncurryThis(f).length == 1 instead of f.length + 1 ``` So, yes, `bind` should produce

Re: Should the length property of bound functions be configurable

2013-08-30 Thread Claude Pache
Le 30 août 2013 à 18:54, Mark S. Miller erig...@google.com a écrit : It seems we have legacy saying that name should be writable. Really? Just tried in the console of the latest stable versions of Firefox, Safari, Chrome and IE: ``` Object.getOwnPropertyDescriptor(function() {}, 'name')

Re: Should the length property of bound functions be configurable

2013-08-30 Thread Claude Pache
Filed bug: https://bugs.ecmascript.org/show_bug.cgi?id=1868 —Claude Le 30 août 2013 à 18:34, Brendan Eich bren...@mozilla.com a écrit : Allen probably could use a bug on file at bugs.ecmascript.org -- anyone? /be Claude Pache mailto:claude.pa...@gmail.com August 30, 2013 5:35 AM

Re: 'void' as a value

2013-09-09 Thread Claude Pache
Le 9 sept. 2013 à 10:35, David Bruant bruan...@gmail.com a écrit : Le 08/09/2013 21:39, Brendan Eich a écrit : In no case does anyone that I've spoken to, on TC39 or anywhere else around this planet, want *yet another* bottom type and singleton value a la null and undefined. No one. Those

Re: 'void' as a value

2013-09-09 Thread Claude Pache
Le 9 sept. 2013 à 11:51, David Bruant bruan...@gmail.com a écrit : Le 09/09/2013 11:41, Claude Pache a écrit : Le 9 sept. 2013 à 10:35, David Bruant bruan...@gmail.com a écrit : Le 08/09/2013 21:39, Brendan Eich a écrit : In no case does anyone that I've spoken to, on TC39 or anywhere else

Re: modulo

2013-09-16 Thread Claude Pache
Le 16 sept. 2013 à 11:30, raul mihaila raul.miha...@gmail.com a écrit : Hello, I think the definition of modulo is wrong. http://people.mozilla.org/~jorendorff/es6-draft.html#sec-5.2 k should be of the same sign as x not as y. I think the definition is correct, and is more useful than

Re: modulo

2013-09-16 Thread Claude Pache
Le 16 sept. 2013 à 13:40, Claude Pache claude.pa...@gmail.com a écrit : Le 16 sept. 2013 à 11:30, raul mihaila raul.miha...@gmail.com a écrit : Hello, I think the definition of modulo is wrong. http://people.mozilla.org/~jorendorff/es6-draft.html#sec-5.2 k should be of the same sign

Re: Set to Array conversions

2013-09-16 Thread Claude Pache
I suggest: [ ... mySet ] or, if you don't want to use any new syntax: Array.from(mySet) —Claude P.S. The syntax `[e for e of mySet]` is outdated in Harmony, you should use `[(for let e of mySet) e]`. Le 16 sept. 2013 à 17:33, Angus Croll anguscr...@gmail.com a écrit : I'm

Re: Set to Array conversions

2013-09-16 Thread Claude Pache
Le 16 sept. 2013 à 18:38, Brendan Eich bren...@mozilla.com a écrit : Claude, thanks for answering, one correction at bottom: Claude Pache mailto:claude.pa...@gmail.com September 16, 2013 11:42 AM I suggest: [ ... mySet ] or, if you don't want to use any new syntax: Array.from(mySet

Re: A new ES6 draft is available

2013-10-01 Thread Claude Pache
Le 1 oct. 2013 à 19:33, Brendan Eich bren...@mozilla.com a écrit : Allen Wirfs-Brock wrote: Currently, that works for everything but null and undefined, so I assume that this pattern is used quite a bit. Do you think it really is? I don't. (That is, I don't see much x.toString()

Re: A new ES6 draft is available

2013-10-01 Thread Claude Pache
Explicit .toString() calling is rare because verbose, in addition to throwing on null and undefined. People use + ''. I tend to use `String(x)` (which is equivalent). Actually it isn't. String(x) is specified to call the ToString abstract operation on x which in the current

std:iteration exports

2013-10-07 Thread Claude Pache
According to the latest version of the ES6 draft, section 25.2 [1], the std:iteration module exports these names: * iterator * GeneratorFunction * Generator I have two questions: 1. What does the iterator name refer to? My guess is that it is intended to give access the @@iterator symbol. 2.

Re: std:iteration exports

2013-10-07 Thread Claude Pache
Ok, thanks. —Claude Le 7 oct. 2013 à 14:35, Allen Wirfs-Brock al...@wirfs-brock.com a écrit : this material will be gone from the next draft. At the last TC39 meeting we agreed that they were unnecessary. Allen On Oct 7, 2013, at 8:23 AM, Claude Pache wrote: According

Re: Are internal data properties ever inherited?

2013-10-08 Thread Claude Pache
Le 8 oct. 2013 à 07:21, Allen Wirfs-Brock al...@wirfs-brock.com a écrit : On Oct 7, 2013, at 8:05 PM, Nathan Wall wrote: Set foo to bar.[[Baz]] Does `foo` ever result in a non-undefined value if `bar` doesn't have an own `[[Baz]]` property but inherits from an object that has an

Re: Are there any plans to introduce Date/Time literals?

2013-10-09 Thread Claude Pache
Le 9 oct. 2013 à 18:46, Oliver Hunt oli...@apple.com a écrit : On Oct 9, 2013, at 1:35 AM, Claude Pache claude.pa...@gmail.com wrote: Le 8 oct. 2013 à 23:43, Andrew Fedoniouk n...@terrainformatica.com a écrit : Quite often Date values are used in data exchanges in form of JS

Working with grapheme clusters

2013-10-24 Thread Claude Pache
Hello, You might know that the following ES expressions are broken: text.charAt(0) // get the first character of the text text.length 100 ? text.substring(0,100) + '...' : text // cut the text after 100 characters The reason is *not* because ES works with UTF-16 code units

Re: Working with grapheme clusters

2013-10-24 Thread Claude Pache
Le 24 oct. 2013 à 16:24, Mathias Bynens math...@qiwi.be a écrit : text.graphemeAt(0) // get the first grapheme of the text // shorten a text to its first hundred graphemes var shortenText = '' let numGraphemes = 0 for (let grapheme of text) {

Re: Math.sign vs ±0

2013-10-30 Thread Claude Pache
Le 30 oct. 2013 à 04:54, Oliver Hunt oli...@apple.com a écrit : As currently specified Math.sign has 5 different return values and, as far as i can tell, does not solve the problem I thought it was trying to address. That is the difficulty in distinguishing positive and negative numbers

Re: Math.sign vs ±0

2013-10-30 Thread Claude Pache
Le 30 oct. 2013 à 11:44, K. Gadd k...@luminance.org a écrit : Unfortunately Claude, ES Math.sign is not Signum; it has five outputs, not three, like Oliver was asking about. Observe: Math.sign(1 / 0) 1 Math.sign(-1 / 0) -1 Math.sign(-1 / 0 * 0) NaN Math.sign(0 * -1) -0

Re: Generator Arrow Functions

2013-11-15 Thread Claude Pache
Le 15 nov. 2013 à 17:59, Rick Waldron waldron.r...@gmail.com a écrit : On Fri, Nov 15, 2013 at 11:34 AM, Axel Rauschmayer a...@rauschma.de wrote: (...) That would make the async programming code more compact, too (I’m assuming a nullary paren-free arrow variant and I prefer the

Re: Function.prototype.apply() Function.prototype.call() with `undefined` or `null` as `thisArg`

2013-12-10 Thread Claude Pache
Le 10 déc. 2013 à 13:59, Mathias Bynens math...@qiwi.be a écrit : From http://ecma-international.org/ecma-262/5.1/#sec-15.3.4.3 and http://ecma-international.org/ecma-262/5.1/#sec-15.3.4.4: The `thisArg` value is passed without modification as the `this` value. This is a change from

Re: toLocaleString in Object and Array

2013-12-11 Thread Claude Pache
It should be ensured that the default implementation of `Array.prototype.toLocaleString` will always produce consistent localisations for both the list separator (by default `,`) and the array elements. For instance, the array `[1.2, 3]` might be transformed, under `.toLocaleString`, into

Object.assign with several source objects

2013-12-17 Thread Claude Pache
Hello, Tonight, when playing with ES6’s new functions, I was wishing that `Object.assign` could accept several `source` objects: Object.assign(target, source1, source2, ...) // equivalent to `Object.assign(Object.assign(Object.assign(target, source1), source2), ...)` My use case: I have

Re: About Array.of()

2013-12-18 Thread Claude Pache
Well, even it's confusing it's still better than `of` for the use case, and some other alternatives: Array.fromItems // fromXXX has another benifit that alternative constructors (String.fromCharCode, Array.from) all begin with `from` Array.fromList Array.fromArguments Array.newArray

Re: const VS features detection

2013-12-20 Thread Claude Pache
Le 20 déc. 2013 à 08:36, Andrea Giammarchi andrea.giammar...@gmail.com a écrit : as side note: in node.js using --harmony flag ... what a developer should do there to understand that a partially non standard version of Proxy is there instead of the real one? Let's imagine I am a

Re: Should the default constructor return the return value of super?

2013-12-27 Thread Claude Pache
Le 25 déc. 2013 à 03:41, Sebastian Markbåge sebast...@calyptus.eu a écrit : This is an esoteric and ugly use case but I'm not trolling. The default constructor for a class which extends another is: constructor(...args){ super(...args); } Is there any reason it shouldn't return the

Re: Overly complicated Array.from?

2013-12-27 Thread Claude Pache
Le 26 déc. 2013 à 18:20, David Bruant bruan...@gmail.com a écrit : Le 26/12/2013 10:58, David Bruant a écrit : Le 26/12/2013 05:00, Rick Waldron a écrit : On Wed, Dec 25, 2013 at 7:33 PM, David Bruant For the rationale, the wiki states [1]: There are many array-like objects in JS

Re: Enumerability

2014-01-10 Thread Claude Pache
Le 9 janv. 2014 à 12:21, Axel Rauschmayer a...@rauschma.de a écrit : I’m still really unhappy about enumerability in ECMAScript. I find it frustratingly inconsistent: * At the moment, only Object.keys and the for-in loop are affected by it. * In ECMAScript 6, Object.assign will also

Re: Operator overloading for non-value objects

2014-01-13 Thread Claude Pache
Le 13 janv. 2014 à 11:45, Anne van Kesteren ann...@annevk.nl a écrit : url.toString() == url2.toString() Experiences on latest versions of Firefox and Safari: `url.toString()` and `url.valueOf()` give me `[object URL]`. I expected to obtain an equivalent of `url.href`. I haven't found

Re: Operator overloading for non-value objects

2014-01-14 Thread Claude Pache
Le 13 janv. 2014 à 11:45, Anne van Kesteren ann...@annevk.nl a écrit : In a discussion I had with Alex Russell as how to do comparison for URL objects it ended up with desiring url == url2 to work. It escaped me at that point that I already discussed this briefly and Brendan explained

Re: Reason why generators do not have references to themselves?

2014-01-25 Thread Claude Pache
Le 24 janv. 2014 à 10:06, Bradley Meck bradley.m...@gmail.com a écrit : (...) I still have to use new when invoking the generator function which feels dirty in my mind. Interestingly, using `new` when invoking a generator function feels cleaner in my mind. :-) In short (and since it is

  1   2   3   4   5   >