RE: Questions on clz and toInteger

2013-07-12 Thread Domenic Denicola
From: Tab Atkins Jr. [mailto:jackalm...@gmail.com] > Exactly, which is why we can only *accurately* answer for numbers <= 2^53-1. Probably a horrible idea in practice, but I feel like the correct answer here is `throw`ing outside that range. It's like asking "is Tab's second head blonde or bru

Re: Questions on clz and toInteger

2013-07-12 Thread Tab Atkins Jr.
On Fri, Jul 12, 2013 at 6:39 PM, Jeff Walden wrote: > On 07/12/2013 06:17 PM, Tab Atkins Jr. wrote: >> On Fri, Jul 12, 2013 at 5:15 PM, Domenic Denicola >> wrote: >>> While I sympathize with the desire to make "integer" mean "mathematical >>> integer," I don't think it's going to work out very w

Re: Questions on clz and toInteger

2013-07-12 Thread Jeff Walden
On 07/12/2013 06:17 PM, Tab Atkins Jr. wrote: > On Fri, Jul 12, 2013 at 5:15 PM, Domenic Denicola > wrote: >> While I sympathize with the desire to make "integer" mean "mathematical >> integer," I don't think it's going to work out very well. Nobody actually >> cares about such functions, and yo

Re: Questions on clz and toInteger

2013-07-12 Thread Tab Atkins Jr.
On Fri, Jul 12, 2013 at 5:15 PM, Domenic Denicola wrote: > While I sympathize with the desire to make "integer" mean "mathematical > integer," I don't think it's going to work out very well. Nobody actually > cares about such functions, and you of course have the WATs of > > ```js > Number.isInt

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Allen Wirfs-Brock
On Jul 12, 2013, at 5:09 PM, Andrew Fedoniouk wrote: > > Your hypothesis would be true if not this case: > > return > { a:1 }; > > Why it injects ';' after the return? This Because, the actual ECMAScript grammar says a new line can't occur between the 'return' keyword and the optional retur

RE: Questions on clz and toInteger

2013-07-12 Thread Domenic Denicola
While I sympathize with the desire to make "integer" mean "mathematical integer," I don't think it's going to work out very well. Nobody actually cares about such functions, and you of course have the WATs of ```js Number.isInteger(9007199254740992.5) === true ``` since the runtime couldn't dis

Re: more numeric constants please (especially EPSILON)

2013-07-12 Thread Jeff Walden
On 07/12/2013 04:53 PM, Mark S. Miller wrote: > I would like a better API -- both less likely to be used unsafely and no > harder (or not much harder) to use safely. Suggestions? In C++ you'd want MS's SafeInt, or WTF's CheckedInt, with operator overloading and all that jazz. Without operator o

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Andrew Fedoniouk
On Fri, Jul 12, 2013 at 4:17 PM, Tab Atkins Jr. wrote: > On Fri, Jul 12, 2013 at 3:55 PM, Andrew Fedoniouk > wrote: >> Seems like I am not getting that famous ASI thing. >> >> I do not understand why here: >> >> foo >> (exp); >> >> there is no semicolon injected. It rather should be this: >>

Re: Questions on clz and toInteger

2013-07-12 Thread Jeff Walden
On 07/12/2013 04:56 PM, Allen Wirfs-Brock wrote: > So you seem to be saying that that > Number.isInteger(MAX_VALUE) should be true, but that Number.MAX_VALUE > > Number.MAX_INTEGER is also true because for isInteger you using the > mathematical definition of "Integer" but for MAX_INTEGER you

Re: Why is .bind so slow?

2013-07-12 Thread Andrea Giammarchi
one more thing ... I believe this will impact arrow function too since is basically bound callbacks all over the place (or at least this is how I believe it will be transpiled) On Fri, Jul 12, 2013 at 4:57 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > just to add some extra info

Re: Why is .bind so slow?

2013-07-12 Thread Andrea Giammarchi
just to add some extra info to this discussion, lo-dash does some crazy thing to optimize at its best bound functions. `/\bthis\b/.test(Function.prototype.toString.call(callback))` or something similar to check if the function needs to use call/apply at all, together with the number of arguments,

Re: Questions on clz and toInteger

2013-07-12 Thread Allen Wirfs-Brock
On Jul 12, 2013, at 4:39 PM, Jeff Walden wrote: > On 07/12/2013 04:32 PM, Allen Wirfs-Brock wrote: >> So the other thread was a discussion concerning the appropriate value of >> Number.MAX_INTEGER. Do you think it should be 2^53-1, or 2^53, or the same >> thing as Math..MAX_VALUE. > > Number.M

Re: Questions on clz and toInteger

2013-07-12 Thread Jeff Walden
On 07/12/2013 04:32 PM, Allen Wirfs-Brock wrote: > So the other thread was a discussion concerning the appropriate value of > Number.MAX_INTEGER. Do you think it should be 2^53-1, or 2^53, or the same > thing as Math..MAX_VALUE. Number.MAX_INTEGER should be 2**53. People who want 2**53 - 1 (and

Re: Questions on clz and toInteger

2013-07-12 Thread Jorge Chamorro
On 13/07/2013, at 01:24, Jeff Walden wrote: > On 07/12/2013 04:13 PM, Tab Atkins Jr. wrote: >> If you don't agree with that reasoning, then I suppose you'd argue >> that *all* numbers > 2^53 should return true, since they're all forced >> into being represented as integers? > > All numbers >= 2*

Re: Questions on clz and toInteger

2013-07-12 Thread Allen Wirfs-Brock
On Jul 12, 2013, at 4:18 PM, Jeff Walden wrote: > On 07/12/2013 04:03 PM, Allen Wirfs-Brock wrote: >> are you suggesting that if we want such an function, it should be named >> something else, such as isExactInteger, isPreciseInteger, >> isUnambiguousInteger, etc? > > Possibly, but I don't th

Re: more numeric constants please (especially EPSILON)

2013-07-12 Thread Jeff Walden
On 07/12/2013 04:09 PM, Tab Atkins Jr. wrote: > Mark's Nat() function *does* throw if the input isn't an > exactly-representable number. Yes. I'm arguing that's not helpful when you can compute an exactly-representable number, that is the result of an inexact calculation, like |Math.pow(2, 53)

Re: Questions on clz and toInteger

2013-07-12 Thread Jeff Walden
On 07/12/2013 04:13 PM, Tab Atkins Jr. wrote: > If you don't agree with that reasoning, then I suppose you'd argue > that *all* numbers > 2^53 should return true, since they're all forced > into being represented as integers? All numbers >= 2**53 except Infinity, yes. I think "isInteger" implies

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Tab Atkins Jr.
On Fri, Jul 12, 2013 at 3:55 PM, Andrew Fedoniouk wrote: > Seems like I am not getting that famous ASI thing. > > I do not understand why here: > > foo > (exp); > > there is no semicolon injected. It rather should be this: > > foo; > (exp); > > if that ASI thing has any traces of logic beh

Re: Questions on clz and toInteger

2013-07-12 Thread Jeff Walden
On 07/12/2013 04:03 PM, Allen Wirfs-Brock wrote: > are you suggesting that if we want such an function, it should be named > something else, such as isExactInteger, isPreciseInteger, > isUnambiguousInteger, etc? Possibly, but I don't think so. Whether a value is exact or precise is a function

Re: Questions on clz and toInteger

2013-07-12 Thread Tab Atkins Jr.
On Fri, Jul 12, 2013 at 3:54 PM, Jeff Walden wrote: > On 07/12/2013 10:27 AM, Tab Atkins Jr. wrote: >> And, because of what we discussed in the recent thread... >> >> Number.isInteger(Math.pow(2,53)-1) == true >> Number.isInteger(Math.pow(2,53)) == false > > I need to comment in the other thread a

Re: more numeric constants please (especially EPSILON)

2013-07-12 Thread Tab Atkins Jr.
On Fri, Jul 12, 2013 at 4:07 PM, Jeff Walden wrote: > On 07/09/2013 06:49 PM, Mark S. Miller wrote: >> Because Nat includes 2**53, this code actually fails to enforce conservation >> of currency!! > > The problem isn't that Nat includes 2**53. It's that you're performing an > operation that may

Re: more numeric constants please (especially EPSILON)

2013-07-12 Thread Jeff Walden
On 07/09/2013 06:49 PM, Mark S. Miller wrote: > Because Nat includes 2**53, this code actually fails to enforce conservation > of currency!! The problem isn't that Nat includes 2**53. It's that you're performing an operation that may compute an inexact value, then you're treating that inexact

Re: Why is .bind so slow?

2013-07-12 Thread Matthew Robb
If a function proxy is just forwarding an operation through an intermediary (the proxy and it's call trap) to another function it sounds very similar to a regularly wrapped/bound js function. So what I am saying is if browsers implemented bind using a proxy instead of the special native functions i

Re: Questions on clz and toInteger

2013-07-12 Thread Allen Wirfs-Brock
On Jul 12, 2013, at 3:54 PM, Jeff Walden wrote: > On 07/12/2013 10:27 AM, Tab Atkins Jr. wrote: >> And, because of what we discussed in the recent thread... >> >> Number.isInteger(Math.pow(2,53)-1) == true >> Number.isInteger(Math.pow(2,53)) == false > > I need to comment in the other thread ag

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Andrew Fedoniouk
On Fri, Jul 12, 2013 at 2:06 PM, Rick Waldron wrote: > > > > On Fri, Jul 12, 2013 at 1:42 PM, Andrew Fedoniouk > wrote: >> ... >> >> This construction >> >> foo {}; >> >> is an equivalent of: >> >> foo({}); >> >> but not >> >> foo(); > > > > Right, I get that... but what I'm telling you is

Re: Questions on clz and toInteger

2013-07-12 Thread Jeff Walden
On 07/12/2013 10:27 AM, Tab Atkins Jr. wrote: > And, because of what we discussed in the recent thread... > > Number.isInteger(Math.pow(2,53)-1) == true > Number.isInteger(Math.pow(2,53)) == false I need to comment in the other thread again and push back against what people have said there, but

Re: Why is .bind so slow?

2013-07-12 Thread Allen Wirfs-Brock
On Jul 12, 2013, at 1:55 PM, Matthew Robb wrote: > In the future wouldn't using a Function Proxy be potentially much faster? It seems highly unlikely that any use of Proxy will be faster than a rough equivalent using an ordinary object. I expect proxies to be much harder for implementations to

Re: Questions on clz and toInteger

2013-07-12 Thread Allen Wirfs-Brock
On Jul 12, 2013, at 1:48 PM, Mark S. Miller wrote: > On Fri, Jul 12, 2013 at 11:00 AM, Tab Atkins Jr. wrote: > On Fri, Jul 12, 2013 at 10:48 AM, Allen Wirfs-Brock > wrote: > > > > In other words you want to define Number.isInteger to return true only if > > it's argument is an integer number

Re: Why is .bind so slow?

2013-07-12 Thread Claus Reinke
Thanks, kg! Your message represents the kind of discussion/information I was hoping for. If your hunch as to the reason is correct, it would seem an easy target for optimization. Partially and efficiently emulating arrow functions in ES6 transpilers should be a strong argument in favor, though n

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Rick Waldron
On Fri, Jul 12, 2013 at 2:08 PM, Andrew Fedoniouk wrote: > On Fri, Jul 12, 2013 at 7:02 AM, Rick Waldron > wrote: > > > > > > > > On Fri, Jul 12, 2013 at 12:22 AM, Andrew Fedoniouk > > wrote: > >> > >> Quite often I see constructions like this: > >> > >> foo({one:1,two:2}); > >> > >> so call o

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Rick Waldron
On Fri, Jul 12, 2013 at 1:42 PM, Andrew Fedoniouk wrote: > On Fri, Jul 12, 2013 at 6:45 AM, Rick Waldron > wrote: > > > > > > > > On Fri, Jul 12, 2013 at 12:22 AM, Andrew Fedoniouk > > wrote: > >> > >> Quite often I see constructions like this: > >> > >> foo({one:1,two:2}); > >> > >> so call o

Re: Why is .bind so slow?

2013-07-12 Thread Matthew Robb
In the future wouldn't using a Function Proxy be potentially much faster? On Fri, Jul 12, 2013 at 1:12 PM, K. Gadd wrote: > I've had some back and forth with v8 devs about this since it affects my > compiler. I believe they already have open issues about it but I don't know > the bug #s. > > In

Re: JS Ctypes

2013-07-12 Thread Andrea Giammarchi
for JS Ctypes I meant binary data, as written in the Brendan link I've posted at the beginning, and the part I've played a while ago: http://webreflection.blogspot.com/2011/09/introduction-to-js-ctypes.html It looks like that part, the binary data, and structs, will be in ES6 so ... good news, and

Re: Proposal: new Symbol(obj)

2013-07-12 Thread Jeremy Martin
My expectation would be that... (a === b) === (new Symbol(a) === new Symbol(b)) I.e., `new Symbol(a) === new Symbol(b)` iff `a === b`. This satisfies the strings/integers scenario, but, of course, fails your WeakMap garbage collection semantics. You need WeakSymbolMaps (+ this proposal) :) On

Re: Proposal: new Symbol(obj)

2013-07-12 Thread K. Gadd
I would welcome (with fanfare and parades) a new Symbol(obj) that worked for strings and integers. Such is not possible using the WeakMap shim (you'd have to detect the type of the value and have multiple dictionaries, or something, and you'd leak the symbols forever...) Of course, what that means

Re: Why is .bind so slow?

2013-07-12 Thread K. Gadd
I've had some back and forth with v8 devs about this since it affects my compiler. I believe they already have open issues about it but I don't know the bug #s. In general, the problem seems to be that Function.bind creates functions that have different type information from normal functions you w

Re: Proposal: new Symbol(obj)

2013-07-12 Thread Jeremy Martin
Good point, that's definitely a usable solution (also a better representation of what I was attempting to describe). I'd still be interested in a less-verbose/more-efficient approach using the Symbol constructor, but it may not be a common enough scenario to justify it when a workaround does exist

Re: Proposal: new Symbol(obj)

2013-07-12 Thread Allen Wirfs-Brock
On Jul 12, 2013, at 12:14 PM, Jeremy Martin wrote: > In brief: allow Symbol's to be constructed with a single parameter, with the > following behavior: > > > var obj = {}; > undefined > > new Symbol({}) === new Symbol({}) > false > > new Symbol(obj) === new Symbol(obj) > true You can use a Wea

Proposal: new Symbol(obj)

2013-07-12 Thread Jeremy Martin
In brief: allow Symbol's to be constructed with a single parameter, with the following behavior: > var obj = {}; undefined > new Symbol({}) === new Symbol({}) false > new Symbol(obj) === new Symbol(obj) true Motivation: the ability to construct equal Symbols gives us the necessary building blocks

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Andrew Fedoniouk
On Fri, Jul 12, 2013 at 11:20 AM, Tab Atkins Jr. wrote: > On Thu, Jul 11, 2013 at 9:22 PM, Andrew Fedoniouk > wrote: >> Quite often I see constructions like this: >> >> foo({one:1,two:2}); >> >> so call of function with single parameter - object literal. >> Idiom named "Poor man named arguments

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Tab Atkins Jr.
On Thu, Jul 11, 2013 at 9:22 PM, Andrew Fedoniouk wrote: > Quite often I see constructions like this: > > foo({one:1,two:2}); > > so call of function with single parameter - object literal. > Idiom named "Poor man named arguments passing" > > Idea is to extend existing JS/ES syntax calls to suppo

Re: JS Ctypes

2013-07-12 Thread Oliver Hunt
Python isn't use to run arbitrary untrusted code, from untrusted websites. The reality is that we thinking about features you want in ES, it's not enough for another language to have the feature, you have to ask yourself whether the other language is primarily used for untrusted code. --Oliver

Re: JS Ctypes

2013-07-12 Thread Andrea Giammarchi
On Fri, Jul 12, 2013 at 11:22 AM, Oliver Hunt wrote: > Python isn't use to run arbitrary untrusted code, from untrusted websites. > neither is node ... but actually, not even JS ... it could, of course, so could Python evaluate random generated code if needed. In few words I've always been skep

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Andrew Fedoniouk
On Fri, Jul 12, 2013 at 7:02 AM, Rick Waldron wrote: > > > > On Fri, Jul 12, 2013 at 12:22 AM, Andrew Fedoniouk > wrote: >> >> Quite often I see constructions like this: >> >> foo({one:1,two:2}); >> >> so call of function with single parameter - object literal. >> Idiom named "Poor man named arg

Re: JS Ctypes

2013-07-12 Thread Andrea Giammarchi
python has ctypes and is widely used, having something similar in JS would have been awesome too, didn't know it was unsafe. Is that because of the proposal or because JS is not suitable for user managed structs? Thanks On Fri, Jul 12, 2013 at 11:01 AM, Brendan Eich wrote: > JSCTypes is unsaf

Re: [syntax] arrow function notation is too "greedy"

2013-07-12 Thread Brendan Eich
Brendan Eich wrote: Andrew Fedoniouk wrote: So that can be compiled to stack machine strictly in order it is defined. Or do you mean something else here? You're right, that case can be handled, but the for loops and the left-hand side revisions remain. Sorry, callee revisions. Depending o

Re: JS Ctypes

2013-07-12 Thread Brendan Eich
JSCTypes is unsafe, it won't be standardized and we restrict access to Firefox add-ons and "chrome" (privileged UX implementation) code. Binary data and value objects cover the "fast typed structs/primitives". Unsafe FFI is a different issue and should not be mixed up with structs and scalar/S

Re: Questions on clz and toInteger

2013-07-12 Thread Tab Atkins Jr.
On Fri, Jul 12, 2013 at 10:48 AM, Allen Wirfs-Brock wrote: > On Jul 12, 2013, at 10:27 AM, Tab Atkins Jr. wrote: >> On Fri, Jul 12, 2013 at 10:19 AM, Mark S. Miller wrote: >>> No. Even if toInteger meant "no fractional component", I would still expect >>> it only to return true if there is some s

Re: Why is .bind so slow?

2013-07-12 Thread Brendan Eich
Allen Wirfs-Brock wrote: you might consider ticketing performance bugs against the various implementations. Right, and at most summarize with links to those issues for es-discuss. This is not a language issue, rather a quality of implementation one. /be Allen On Jul 10, 2013, at 9:16 AM

Re: Why is .bind so slow?

2013-07-12 Thread Oliver Hunt
Just to clarify, JSRegress is not a "benchmark" in the sunspider/kraken/etc sense, as the tests tend far more towards microbenchmarks than full "real" programme tests. As the name suggests its main purpose is to help us make sure we're not regressing core language primitives. --Oliver On Jul

Re: [syntax] arrow function notation is too "greedy"

2013-07-12 Thread Brendan Eich
Andrew Fedoniouk wrote: So that can be compiled to stack machine strictly in order it is defined. Or do you mean something else here? You're right, that case can be handled, but the for loops and the left-hand side revisions remain. /be ___ es-dis

Re: Questions on clz and toInteger

2013-07-12 Thread Allen Wirfs-Brock
On Jul 12, 2013, at 10:27 AM, Tab Atkins Jr. wrote: > On Fri, Jul 12, 2013 at 10:19 AM, Mark S. Miller wrote: >> No. Even if toInteger meant "no fractional component", I would still expect >> it only to return true if there is some specific mathematical integer that >> the JS number can be said

Re: Why is .bind so slow?

2013-07-12 Thread Filip Pizlo
> On Jul 12, 2013, at 10:09 AM, "Mark S. Miller" wrote: > > If you can manage it, most effective would be to get .bind (or any other > operation you want to be faster) into some widely quoted benchmark suite. In WebKit at least, we have a thing called JSRegress which is meant to be a dumping

JS Ctypes

2013-07-12 Thread Andrea Giammarchi
I wonder if there is any interest/plan/scheduled TC39 slot about JS Ctypes, mentioned by [Brendan Eich in his famous TXJS talk]( https://brendaneich.com/2011/08/my-txjs-talk-twitter-remix/) but never again discussed in this ml. Seeing `asm.js` passing through all usual procedures before `JS Ctypes

Re: Questions on clz and toInteger

2013-07-12 Thread Oliver Hunt
On Jul 12, 2013, at 10:19 AM, Mark S. Miller wrote: > No. Even if toInteger meant "no fractional component", I would still expect > it only to return true if there is some specific mathematical integer that > the JS number can be said to exactly represent. For the same reason, I think > isInt

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Andrew Fedoniouk
On Fri, Jul 12, 2013 at 6:45 AM, Rick Waldron wrote: > > > > On Fri, Jul 12, 2013 at 12:22 AM, Andrew Fedoniouk > wrote: >> >> Quite often I see constructions like this: >> >> foo({one:1,two:2}); >> >> so call of function with single parameter - object literal. >> Idiom named "Poor man named arg

Re: Why is .bind so slow?

2013-07-12 Thread Andrea Giammarchi
I think we all know that's extremely slow and since ever. I always wondered the reason too ... in jsperf there are tons of tests about this, here yet another one just quickly created to compare the gap: http://jsperf.com/bind-is-slow in Chrome, bind(context) without even arguments is 87% slower th

Re: Questions on clz and toInteger

2013-07-12 Thread Tab Atkins Jr.
On Fri, Jul 12, 2013 at 10:19 AM, Mark S. Miller wrote: > No. Even if toInteger meant "no fractional component", I would still expect > it only to return true if there is some specific mathematical integer that > the JS number can be said to exactly represent. For the same reason, I think > isInte

Re: Questions on clz and toInteger

2013-07-12 Thread Oliver Hunt
On Jul 12, 2013, at 8:58 AM, Luke Hoban wrote: >> From: Allen Wirfs-Brock [mailto:al...@wirfs-brock.com] >> >> On Jul 11, 2013, at 9:01 PM, Luke Hoban wrote: >> >>> Two questions on new Number APIs: >>> >>> 1) Is it intentional that clz is on Number.prototype instead of Number? >>> Why? >>

Re: Object#extra hazard

2013-07-12 Thread Matthew Robb
With the availability of constants and Symbols you could easily create what SHOULD be a memory efficient event library. On Thu, Jul 11, 2013 at 3:04 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > trivial like ... 2 weak maps + a set for a single event ? > > ```javascript > obj.on(

Re: Why is .bind so slow?

2013-07-12 Thread Allen Wirfs-Brock
you might consider ticketing performance bugs against the various implementations. Allen On Jul 10, 2013, at 9:16 AM, Claus Reinke wrote: > The TypeScript project tries to emulate arrow functions through the > "_this = this" pattern and keeps running into corner cases where a > semi-naïve rena

Re: Questions on clz and toInteger

2013-07-12 Thread Allen Wirfs-Brock
On Jul 12, 2013, at 9:01 AM, Mark Miller wrote: > > > > On Fri, Jul 12, 2013 at 8:58 AM, Luke Hoban wrote: > >From: Allen Wirfs-Brock [mailto:al...@wirfs-brock.com] > > > > >> > >> 2) Is it intentional that Number.toInteger(Infinity) returns true? > >Huh? How's that? > > > >Number.toInteger

Why is .bind so slow?

2013-07-12 Thread Claus Reinke
The TypeScript project tries to emulate arrow functions through the "_this = this" pattern and keeps running into corner cases where a semi-naïve renaming is not sufficient. I have been trying to suggest using .bind to emulate arrow functions instead, but the counter-arguments are (a) .bind might

Re: On IE __proto__ test cases

2013-07-12 Thread Allen Wirfs-Brock
On Jul 11, 2013, at 9:33 PM, Mark S. Miller wrote: > Yes, that was intentional. Even though the "__proto__:" looks related to the > "__proto__" property initially on Object.prototype, that's only cosmetic. It > is now simply part of the object literal syntax, in just the same way that > "<|" u

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Claus Reinke
function f(a, b) { return [a, b]; } Currently: f(1, 2); // [1, 2] Whereas... // single parameter, implicit arguments pseudo-array: f(1, 2); |a| would be magically be treated like a ...rest param that wasn't really an array, but instead a implicit arguments pseudo-array? // [[1, 2],

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Rick Waldron
On Fri, Jul 12, 2013 at 11:07 AM, Claus Reinke wrote: > A slightly less ambitious suggestion: > >consider f() as syntax for the implicit arguments array >(which, as of ES6, can be considered deprecated), then >make the parens in this syntax optional > snip > > In other words, you co

Re: Questions on clz and toInteger

2013-07-12 Thread Mark Miller
On Fri, Jul 12, 2013 at 8:58 AM, Luke Hoban wrote: > >From: Allen Wirfs-Brock [mailto:al...@wirfs-brock.com] > > > >On Jul 11, 2013, at 9:01 PM, Luke Hoban wrote: > > > >> Two questions on new Number APIs: > >> > >> 1) Is it intentional that clz is on Number.prototype instead of Number? > Why? >

RE: Questions on clz and toInteger

2013-07-12 Thread Luke Hoban
>From: Allen Wirfs-Brock [mailto:al...@wirfs-brock.com] > >On Jul 11, 2013, at 9:01 PM, Luke Hoban wrote: > >> Two questions on new Number APIs: >> >> 1) Is it intentional that clz is on Number.prototype instead of Number? Why? > >I think there is a stronger case to me made for Math.clz(number).

Re: Questions on clz and toInteger

2013-07-12 Thread Allen Wirfs-Brock
On Jul 11, 2013, at 9:01 PM, Luke Hoban wrote: > Two questions on new Number APIs: > > 1) Is it intentional that clz is on Number.prototype instead of Number? Why? Generally, operations that operate upon a value of a specific type are expressed as instance methods. We see this all the time w

Re: Maps and Sets, goodbye polyfill ?!

2013-07-12 Thread Claus Reinke
In general, generators are very hard to polyfill. (Not impossible, as you can do a CPS transform of the source code, but very difficult.) It depends on what you want. For concise specification of iteration, you can do something without full CPS transform, by using monadic coding style. My scrat

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Claus Reinke
A slightly less ambitious suggestion: consider f() as syntax for the implicit arguments array (which, as of ES6, can be considered deprecated), then make the parens in this syntax optional In other words, you could write f 1 // single parameter f(1,2)// single parameter, im

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Rick Waldron
On Fri, Jul 12, 2013 at 12:22 AM, Andrew Fedoniouk < n...@terrainformatica.com> wrote: > Quite often I see constructions like this: > > foo({one:1,two:2}); > > so call of function with single parameter - object literal. > Idiom named "Poor man named arguments passing" > > Idea is to extend existi

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Rick Waldron
On Fri, Jul 12, 2013 at 12:22 AM, Andrew Fedoniouk < n...@terrainformatica.com> wrote: > Quite often I see constructions like this: > > foo({one:1,two:2}); > > so call of function with single parameter - object literal. > Idiom named "Poor man named arguments passing" > > Idea is to extend existi

Re: [proposal] Function calls, syntax sugar

2013-07-12 Thread Axel Rauschmayer
I like the idea, maybe we could do the following: foo(posArg1, posArg2, name1: x, name2: y) as syntactic sugar for: foo(posArg1, posArg2, { name1: x, name2: y }) Axel On Jul 12, 2013, at 6:22 , Andrew Fedoniouk wrote: > Quite often I see constructions like this: > > foo({one:1,two