use strict; prepended blindly to scripts in the wild

2010-09-19 Thread Andrea Giammarchi
be the reserved label name for use strict activation. What do you think? Best Regards, Andrea Giammarchi ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: not a Date object vs. not an object with [[Class]] of ''Date''

2010-10-02 Thread Andrea Giammarchi
with randomly extended native prototypes. Regards, Andrea Giammarchi On Sat, Oct 2, 2010 at 11:05 PM, Dmitry A. Soshnikov dmitry.soshni...@gmail.com wrote: On 03.10.2010 0:58, Dmitry A. Soshnikov wrote: On 03.10.2010 0:51, Brendan Eich wrote: On Oct 2, 2010, at 6:49 AM, Jorge wrote: On 02

Re: not a Date object vs. not an object with [[Class]] of ''Date''

2010-10-03 Thread Andrea Giammarchi
I don't know man, I kinda like the possibility, but I am pretty sure we gonna end up trying to figure out via weird tricks if an Array is a native one or not (e.g. Array.isReallyAnArray(obj)) ... however, it's good to have more power than less ;-) Regards, Andrea Giammarchi On Sun, Oct 3

Re: Pure win: Array.from and Array.of

2011-07-26 Thread Andrea Giammarchi
glad somebody said that! Also I would pollute performance oriented methods rather than whatever framework sugar anybody could easily add where unique() and remove(all) may be part of these cases while fill() could be superfluous. Andrea On Mon, Jul 11, 2011 at 6:01 PM, Allen Wirfs-Brock

Re: Wanted: standard Array function to append an array's

2011-07-29 Thread Andrea Giammarchi
I may be late here, but what's wrong with firstArray = firstArray.concat(secondArray); ? If there are still problems I would say no magic method can solve them, isn't it? On Fri, Jul 29, 2011 at 1:59 AM, Jeff Walden jwalden...@mit.edu wrote: On 07/27/2011 01:26 PM, John-David Dalton wrote:

Re: Wanted: standard Array function to append an array's elements to another array

2011-07-29 Thread Andrea Giammarchi
the pushAll I wonder if concat does not do already exactly what you are looking for, as I wrote in the other thread. Best Regards, Andrea Giammarchi On Mon, Jul 25, 2011 at 10:17 PM, Jeff Walden jwalden...@mit.edu wrote: It's perhaps worth noting that this problem also occurs

Re: Pure win: Array.from and Array.of

2011-07-30 Thread Andrea Giammarchi
* ... there I would never complain about a Vec3Array with a multiply(Vec3) native method for sure! On Tue, Jul 26, 2011 at 7:59 PM, Alex Russell a...@dojotoolkit.org wrote: On Jul 26, 2011, at 7:10 AM, Andrea Giammarchi wrote: glad somebody said that! Also I would pollute performance oriented

Re: Wanted: standard Array function to append an array's elements to another array

2011-07-31 Thread Andrea Giammarchi
: On 07/29/2011 05:22 AM, Andrea Giammarchi wrote: to avoid apply limits is actually trivial More or less, yes. But it requires the developer to anticipate the concern in advance that the elements being appended might consume all available stack space. I don't think most developers think

An Introduction to JS-Ctypes

2011-09-17 Thread Andrea Giammarchi
and performances speaking it looks like an epic fail so far and please feel free to correct me as much as possible, thanks. Best Regards, Andrea Giammarchi ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es

Re: An Introduction to JS-Ctypes

2011-09-17 Thread Andrea Giammarchi
) Please let me understand how this can be a solution in therms of performances, thanks. Best Regards, Andrea Giammarchi ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: An Introduction to JS-Ctypes

2011-09-17 Thread Andrea Giammarchi
I bet devs will do the same if that will land in JS. I will file the bench at mozilla soon, thanks. On Sat, Sep 17, 2011 at 8:43 PM, Brendan Eich bren...@mozilla.com wrote: On Sep 17, 2011, at 2:34 PM, Andrea Giammarchi wrote: Also I have explicitly slowed down the logic creating a classic

Re: An Introduction to JS-Ctypes

2011-09-17 Thread Andrea Giammarchi
purposes ? What would you expect from a namespace.Array constructor if not something similar or exactly the Array constructor we are all familiar with ? On Sat, Sep 17, 2011 at 8:54 PM, Sam Tobin-Hochstadt sa...@ccs.neu.eduwrote: On Sat, Sep 17, 2011 at 2:34 PM, Andrea Giammarchi

Re: An Introduction to JS-Ctypes

2011-09-17 Thread Andrea Giammarchi
, Brendan Eich bren...@mozilla.com wrote: On Sep 17, 2011, at 10:34 PM, Andrea Giammarchi wrote: Brendan I wrote I did it on purpose trying to predict what JS devs will do once JS.next will bring ctypes like syntax. My objection is that you're confounding test2 by adding object literal overhead

Re: An Introduction to JS-Ctypes

2011-09-17 Thread Andrea Giammarchi
from js-ctypes in therms of raw performances boost On Sun, Sep 18, 2011 at 6:05 AM, Brendan Eich bren...@mozilla.com wrote: On Sep 17, 2011, at 10:39 PM, Andrea Giammarchi wrote: Can we at least agree that if some extension brings *exactly* same constructor name, StructType and ArrayType

Re: An Introduction to JS-Ctypes

2011-09-17 Thread Andrea Giammarchi
On Sun, Sep 18, 2011 at 6:07 AM, Brendan Eich bren...@mozilla.com wrote: Binary data does no such thing! The descriptors are per generated type-constructor, not per instance. once you define a StructType how do create an instance ? new Point2D({x: 0, y: 0}); or binary data can create

Re: An Introduction to JS-Ctypes

2011-09-17 Thread Andrea Giammarchi
, at least it is possible. How did the performance change? in my Mac 13ms VS 16ms surely more if I use the Atom based Netbook Best Regards, Andrea Giammarchi ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es

Re: An Introduction to JS-Ctypes

2011-09-18 Thread Andrea Giammarchi
On Sun, Sep 18, 2011 at 7:17 AM, Brendan Eich bren...@mozilla.com wrote: The point is that you don't *have* to pass a fresh object literal to each constructor call. /be I know Brendan, my point is that I can predict devs will do every time we'll see Thanks for other reply, I thought

Re: An Introduction to JS-Ctypes

2011-09-18 Thread Andrea Giammarchi
object as function argument to obtain similar behavior fn({a: 1, b: 2}) and back to the too many objects created due lack of defaults/named arguments trap ... Never mind, this is not for this thread. Best Regards, Andrea Giammarchi On Sun, Sep 18, 2011 at 3:14 PM, Brendan Eich bren

Re: An Introduction to JS-Ctypes

2011-09-19 Thread Andrea Giammarchi
PM, Brendan Eich bren...@mozilla.com wrote: On Sep 18, 2011, at 12:09 PM, Andrea Giammarchi wrote: I know it's the same, for this reason I said it was shimmable New syntax would be fine as long as minifiers won't break everything so ... as long as minifiers are compatible

On Incremental Updates

2011-10-03 Thread Andrea Giammarchi
-brendan-here-was-my-question.html I would like to thank you in advance for your time and all possible answers/considerations/questions you may come up with. Cheers, Andrea Giammarchi ___ es-discuss mailing list es-discuss@mozilla.org https

Re: On Incremental Updates

2011-10-04 Thread Andrea Giammarchi
changes, will take years before it can be widely adopted and improved, and these years in between will put JavaScript into an even worse position where JS developers will ask themselves: what is exactly JavaScript ? Thanks in any case for your answer. Best Regards, Andrea Giammarchi On Tue

Re: On I got 99 problems and JavaScript syntax ain't one (was: On Incremental Updates)

2011-10-04 Thread Andrea Giammarchi
, thanks. br, WebReflection On Tue, Oct 4, 2011 at 3:16 PM, David Bruant david.bru...@labri.fr wrote: Le 03/10/2011 22:49, Andrea Giammarchi a écrit : Dear All, while I had the opportunity to ask directly to Brendan Eich this question, I would like to ask you 5 minutes of your

Re: On I got 99 problems and JavaScript syntax ain't one

2011-10-05 Thread Andrea Giammarchi
) ; var hasOwnProperty = bind(invoke, {}.hasOwnProperty); hasOwnProperty({key:1}, key); // true call([].slice, [1,2,3], 1); // 2,3 apply([].slice, [1,2,3], [1]); // 2,3 Regards, Andrea Giammarchi ___ es-discuss mailing list es-discuss@mozilla.org

Re: On I got 99 problems and JavaScript syntax ain't one (was: On Incremental Updates)

2011-10-05 Thread Andrea Giammarchi
Here again I am not sure how we ended up with this conversation but you can find a function able to extract properties and methods out of a generic object: https://gist.github.com/1264775 It works with jQuery too, as well as arrays, etc etc Regards, Andrea Giammarchi

Re: On I got 99 problems and JavaScript syntax ain't one (was: On Incremental Updates)

2011-10-05 Thread Andrea Giammarchi
: On Wed, Oct 5, 2011 at 11:48 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: Here again I am not sure how we ended up with this conversation but you can find a function able to extract properties and methods out of a generic object: https://gist.github.com/1264775 It works

Re: On I got 99 problems and JavaScript syntax ain't one (was: On Incremental Updates)

2011-10-05 Thread Andrea Giammarchi
Sorry Russ, I am not sure I got it On Wed, Oct 5, 2011 at 6:14 PM, Russell Leggett russell.legg...@gmail.comwrote: On Wed, Oct 5, 2011 at 12:04 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: with such dynamic language I would never trust much AST This is for realtime, inline

Re: On I got 99 problems and JavaScript syntax ain't one (was: OnIncremental Updates)

2011-10-06 Thread Andrea Giammarchi
as Zend Certified Engineer I can say == and === have never been a problem ... also there are cases when I *want* coercion! var False = new Boolean(false); if (False) alert(You may say WTF); if (False == false) alert(I may say feature); Best Regards, Andrea Giammarchi

Re: Event properties on objects, a proxy experiment

2011-10-15 Thread Andrea Giammarchi
something like this ? ... (function () { function dispatch(callback) { callback.call(this.r, this.e); } function add(callback) { this.handlers.indexOf(callback) 0 this.handlers.push(callback); } function remove(callback) { var i = this.handlers.indexOf(callback); -1 i

Re: Event properties on objects, a proxy experiment

2011-10-15 Thread Andrea Giammarchi
... apologies On Sat, Oct 15, 2011 at 7:44 PM, David Bruant bruan...@gmail.com wrote: Le 15/10/2011 18:26, Andrea Giammarchi a écrit : something like this ? ... My email client says that you're responding to my initial message, but you may as well be responding to my concern about

Re: Event properties on objects, a proxy experiment

2011-10-15 Thread Andrea Giammarchi
with variable event solved }); }; var o = Object.asEmitter(Object.create(null)); o.on.whatever.add(callback); o.on.whatever({type: whatever}); br On Sat, Oct 15, 2011 at 8:19 PM, David Bruant bruan...@gmail.com wrote: Le 15/10/2011 19:52, Andrea Giammarchi a écrit : naaa, event is just

The Missing Tool In Scripting World

2011-10-16 Thread Andrea Giammarchi
Just because in this ml there are many engineers involved in JS engines optimizations ... this is a what if... post, feel free to comment it or hopefully take some hint out of it: http://webreflection.blogspot.com/2011/10/missing-tool-in-scripting-world.html Best Regards

Re: The Missing Tool In Scripting World

2011-10-16 Thread Andrea Giammarchi
with this note ? Thanks On Sun, Oct 16, 2011 at 3:23 PM, Sam Tobin-Hochstadt sa...@ccs.neu.eduwrote: On Sun, Oct 16, 2011 at 8:52 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: Just because in this ml there are many engineers involved in JS engines optimizations ... this is a what if... post

Re: The Missing Tool In Scripting World

2011-10-16 Thread Andrea Giammarchi
for subsequent use on multiple underlying architectures. *From: *Andrea Giammarchi andrea.giammar...@gmail.com *Subject: **The Missing Tool In Scripting World* *Date: *October 16, 2011 14:52:47 GMT+02:00 *To: *es-discuss@mozilla.org es-discuss@mozilla.org Just because in this ml

Re: The Missing Tool In Scripting World

2011-10-16 Thread Andrea Giammarchi
code ... AFAIK not possible right now On Sun, Oct 16, 2011 at 9:15 PM, Sam Tobin-Hochstadt sa...@ccs.neu.eduwrote: On Sun, Oct 16, 2011 at 12:05 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: not natively, and not in the optimized way C or C++ do This is not correct -- SBCL

Re: Array.prototype[0] setter

2011-10-24 Thread Andrea Giammarchi
In webkit nightly not even the getter gets invoked. On Tue, Oct 18, 2011 at 9:31 PM, felix feli...@gmail.com wrote: If I define a setter for Array.prototype[0], does [].push invoke that setter? Test code: !doctype htmlhtmlbody script Object.defineProperty( Array.prototype, 0, {

Re: Array.prototype[0] setter

2011-10-24 Thread Andrea Giammarchi
= 0; a.push = [].push; alert('before push a[0] = ' + a[0]); a.push(44); alert('after push a[0] = ' + a[0]); On Mon, Oct 24, 2011 at 4:12 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: In webkit nightly not even the getter gets invoked. On Tue, Oct 18, 2011 at 9:31 PM, felix feli

Re: Enums?

2011-10-24 Thread Andrea Giammarchi
? Best Regards, Andrea Giammarchi On Mon, Oct 24, 2011 at 8:42 PM, Axel Rauschmayer a...@rauschma.de wrote: FWIW: I’ve blogged about this. http://www.2ality.com/2011/10/enums.html On Oct 3, 2011, at 19:03 , Allen Wirfs-Brock wrote: Channeling for MarkM, if you use regular objects

Re: Enums?

2011-10-24 Thread Andrea Giammarchi
; }(Object, typeof exports == undefined ? this[enum] = {} : exports)); Best Regards, Andrea Giammarchi On Mon, Oct 24, 2011 at 11:53 PM, Axel Rauschmayer a...@rauschma.de wrote: If you don't want Object.prototype (why ?) do you want an enumerable, configurable, writable constructor ? I

Re: Enums?

2011-10-24 Thread Andrea Giammarchi
demonstrated here indeed: http://jsperf.com/array-extras-second-argument on average, closures plus scope lookup looks always slower but I'll add more tests. On Tue, Oct 25, 2011 at 12:23 AM, Brendan Eich bren...@mozilla.com wrote: On Oct 24, 2011, at 2:53 PM, Axel Rauschmayer wrote: that =

Re: Enums?

2011-10-24 Thread Andrea Giammarchi
advantage for both reusability and, now demonstrated, performances. It was nice to test it in any case so thanks. br, Andrea Giammarchi On Tue, Oct 25, 2011 at 12:32 AM, Axel Rauschmayer a...@rauschma.de wrote: Ah, the array extras use pass the second argument

Re: Enums?

2011-10-24 Thread Andrea Giammarchi
yes, even if in a non RequireJS world accessing Enum constructor via enums.Enum does not sound right to me On Tue, Oct 25, 2011 at 12:51 AM, Axel Rauschmayer a...@rauschma.de wrote: Please consider this.enum break all minifiers since enum is a reserved word, I had to do this[enum] = {} at the

Re: Enums?

2011-10-25 Thread Andrea Giammarchi
I work on mobile browsers ... things are up to 1000 times slower there and all tricks, as long as still readable, are welcome in my daily basis work. Best Regards, Andrea Giammarchi On Tue, Oct 25, 2011 at 1:35 AM, Axel Rauschmayer a...@rauschma.de wrote: it must be said the pattern I

Re: missing non-rest_parameters should throw error

2011-10-26 Thread Andrea Giammarchi
I am not sure I am missing something but I think arguments could disappear without problems, being easily simulated like this: function f1(...arguments) { f2.apply(this, arguments); f2(...arguments); let [a,b,c,...rest] = arguments; // etc etc } Am I wrong ? br On Wed, Oct 26,

Re: missing non-rest_parameters should throw error

2011-10-27 Thread Andrea Giammarchi
point 1 is utopia since ...varname breaks syntax in any case second point would be easier like this ? function (arg1obj={a,b,c}, p=[x,y]) { } On Wed, Oct 26, 2011 at 8:27 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: 1) arguments is needed for backwards compatability (no migration tax)

Re: Internationalization feedback

2011-10-29 Thread Andrea Giammarchi
I think the main reason to have a FormatComponent is to give each DateTimeFormat instance a configuration state so that once you define it you can format it automatically any time you print it out. Said that, I am familiar as example with gmdate() PHP function or similar string syntax as it could

Re: On class literals possibly not making it into ECMAScript.next

2011-10-29 Thread Andrea Giammarchi
); } }; SomeSubClass.prototype.genericMethod = genericMethod; Thanks for any sort of clarification. Best Regards, Andrea Giammarchi On Sat, Oct 29, 2011 at 5:45 AM, Brendan Eich bren...@mozilla.com wrote: On Oct 28, 2011, at 8:23 PM, Axel Rauschmayer wrote: The ES.next version is quite nice: [Snip] I have to say

Re: On class literals possibly not making it into ECMAScript.next

2011-10-29 Thread Andrea Giammarchi
(); }; Entity.prototype.hasPoint = false; (new Entity).setPoint(1, 2, 3).isPositive(); // boom ? or super is bound to Point ? br, Andrea Giammarchi On Sat, Oct 29, 2011 at 2:25 PM, Axel Rauschmayer a...@rauschma.de wrote: Summary: true generic |super| hardly ever makes sense. Do you have

Re: On class literals possibly not making it into ECMAScript.next

2011-10-29 Thread Andrea Giammarchi
I sai the example was crap indeed and it doe not matter what it does but how and there is a super call. Will super be assigned runtime or fixed in method creation ? On Sat, Oct 29, 2011 at 4:09 PM, Axel Rauschmayer a...@rauschma.de wrote: Sorry for sounding harsh, but I’m really just curious:

Array extras and Objects

2011-11-30 Thread Andrea Giammarchi
Let's say this is an attempt to bring some new, easy to implement, method for the native Object.prototype Specially about forEach, the most used Array.prototype method out there, it's quite clear JS developers would like to have similar method to iterate over objects, as key:value pairs rather

Re: Array extras and Objects

2011-12-01 Thread Andrea Giammarchi
gazhe...@gmail.com wrote: On 1 December 2011 07:47, Andrea Giammarchi andrea.giammar...@gmail.comwrote: Let's say this is an attempt to bring some new, easy to implement, method for the native Object.prototype Specially about forEach, the most used Array.prototype method out there, it's quite

Re: Array extras and Objects

2011-12-01 Thread Andrea Giammarchi
... iterators not backward compatible ... a failing solution for me for this very simple and common problem :-/ On Thu, Dec 1, 2011 at 2:04 PM, David Bruant bruan...@gmail.com wrote: Le 01/12/2011 08:47, Andrea Giammarchi a écrit : Let's say this is an attempt to bring some new, easy

Re: Array extras and Objects

2011-12-04 Thread Andrea Giammarchi
nothing wrong, that's basically what I do indeed as Object.prototype.forEach but it would be faster done natively On Thu, Dec 1, 2011 at 7:00 PM, Brendan Eich bren...@mozilla.com wrote: On Dec 1, 2011, at 8:00 AM, Andrea Giammarchi wrote: ... iterators not backward compatible ... a failing

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-16 Thread Andrea Giammarchi
you don't use apply randomly, you use apply for methods or getters knowing there is a function there. __noSuchMethod__ is about NOT HAVING A FUNCTION there and if the property is not defined apply should fail as well as obj.undefined.apply would I still do not understand why we keep mixing up

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-16 Thread Andrea Giammarchi
sorry for the typo, this point was 1.2.2.1 yes, invoke that callback via cb.call(object, *methodName*, arguments) On Fri, Dec 16, 2011 at 5:30 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: you don't use apply randomly, you use apply for methods or getters knowing

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-16 Thread Andrea Giammarchi
- From: Andrea Giammarchi andrea.giammar...@gmail.com To: Dmitry Soshnikov dmitry.soshni...@gmail.com Cc: Brendan Eich bren...@mozilla.com, es-discuss es-discuss@mozilla.org Sent: Friday, December 16, 2011 8:30:47 AM Subject: Re: noSuchMethod: funargs + invoke-only-phantoms you don't

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-17 Thread Andrea Giammarchi
Dmitry, addressing a trap fallback is not a good idea plus the average JS coder rarely does it ... said that, the moment you are using a method you already know this exists so you already know the documentation ( or part of it ) so I don't see much hurt there. Moreover, the addressing problem is

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-17 Thread Andrea Giammarchi
and about last point, maybe objects that implements noSuchMethod should return something like unknown via typeof ... just saying, and simply to differentiate these objects from others where __noSuchMethod__ is not in place. On Sat, Dec 17, 2011 at 3:08 PM, Andrea Giammarchi andrea.giammar

Re: noSuchMethod: funargs + invoke-only-phantoms

2011-12-21 Thread Andrea Giammarchi
This is almost the exact behavior I was talking about ... Object.withNoSuchMethod = function withNoSuchMethod(obj, __noSuchMethod__) { var cachedInvokes = {}; return Proxy.create({ get: function (receiver, name) { return name in obj ? obj[name] :

Improving Function.prototype.bind

2012-01-05 Thread Andrea Giammarchi
) === sameObject.asContextOf( genericCallback) Here the whole post with better examples plus the proposed solution that would be nice to have in JS.Next http://webreflection.blogspot.com/2012/01/improving-functionprototypebind.html Best Regards, Andrea Giammarchi ___ es

Re: Improving Function.prototype.bind

2012-01-05 Thread Andrea Giammarchi
: On Jan 5, 2012, at 14:54 , Andrea Giammarchi wrote: Here the whole post with better examples plus the proposed solution that would be nice to have in JS.Next http://webreflection.blogspot.com/2012/01/improving-functionprototypebind.html I don’t use bound() and function expressions very often (I

Re: Improving Function.prototype.bind

2012-01-05 Thread Andrea Giammarchi
, Andrea Giammarchi On Thu, Jan 5, 2012 at 5:11 PM, Axel Rauschmayer a...@rauschma.de wrote: that would not solve much 'cause you can bind a function to a single object and no more. Isn’t that the most frequent use case? Do you have examples where you bind the same function to several

Re: Improving Function.prototype.bind

2012-01-05 Thread Andrea Giammarchi
over what I propose? David [1] https://gist.github.com/1567494 Le 05/01/2012 14:54, Andrea Giammarchi a écrit : I have thought it may be interesting to receive some comment here too ... so here the short summary: genericCallback.bind(sameObject) !== genericCallback.bind(sameObject

Re: Improving Function.prototype.bind

2012-01-05 Thread Andrea Giammarchi
Guys, by any chance we can go back into the topic? I was not thinking about changing the meaning of this in a function, also Python sends explicit self context as first argument so things are slightly different in any case Point is: - bind was one of the most needed/used Function.prototype

Re: Improving Function.prototype.bind

2012-01-05 Thread Andrea Giammarchi
wrote in his last reply could not happen ... everything will work as expected. Any better ? I can try to explain even more, if necessary, or provide better specifications aligned with current ES5 terminology Best Regards, Andrea Giammarchi P.S. is it really just me that see the problem

Re: Improving Function.prototype.bind

2012-01-06 Thread Andrea Giammarchi
same thing this does var bound = Object.bind(Object); bound.foo = capabilityBobShouldntGet; // who does this ? var HAH = bound.foo; ... so I am missing your point I guess ... but my proposal wants to return always same object for 99.9% of usage out there ... On Fri, Jan 6, 2012 at 8:55 AM,

Re: Improving Function.prototype.bind

2012-01-06 Thread Andrea Giammarchi
boundFunction and store it into objToBind.[[boundFunctions]] - return the newly created boundFunction Would that be possible? François -Message d'origine- From: Brendan Eich Sent: Friday, January 06, 2012 2:22 AM To: Andrea Giammarchi Cc: Axel Rauschmayer ; François REMY ; es

Re: Improving Function.prototype.bind

2012-01-06 Thread Andrea Giammarchi
On Fri, Jan 6, 2012 at 10:50 AM, David Bruant bruan...@gmail.com wrote: Your proposal won't be implemented in older browsers. Actually, it is very likely that your proposal would be implemented in browsers that would already have weak maps. Under these conditions. What is the benefit of a

Re: Improving Function.prototype.bind

2012-01-06 Thread Andrea Giammarchi
it doesn't ... as soon as you release the reference to o no leaks persists but of course until you keep o on hold those unique callbacks cannot be released ... but this would be true with WeakMap too, isn't it? In any case, boundTo is suitable for listeners and the whole point is to do not hold

Re: Improving Function.prototype.bind

2012-01-06 Thread Andrea Giammarchi
libraries ... but if this is the logic, I wonder what is ES5 about with all its extras ( Array, Function, String, etc ) Regards On Fri, Jan 6, 2012 at 12:42 PM, David Bruant bruan...@gmail.com wrote: Le 06/01/2012 12:23, Andrea Giammarchi a écrit : it doesn't ... as soon as you release

Re: Improving Function.prototype.bind

2012-01-06 Thread Andrea Giammarchi
= object.method.bind(object); Above pattern is able to destroy entire framework but nobody ever complained ... well, glad to be the first one. br On Fri, Jan 6, 2012 at 4:23 PM, David Bruant bruan...@gmail.com wrote: Le 06/01/2012 12:51, Andrea Giammarchi a écrit : unreachable without reference count? do you

Re: Improving Function.prototype.bind

2012-01-06 Thread Andrea Giammarchi
: On Fri, Jan 6, 2012 at 1:50 AM, David Bruant bruan...@gmail.com wrote: Le 06/01/2012 10:40, Andrea Giammarchi a écrit : if WeakMaps are so smart ... it means we cannot shim them without causing leaks in non WeakMap ready browsers since no magic will happen,objects as keys will simply be persistent

Re: Improving Function.prototype.bind

2012-01-06 Thread Andrea Giammarchi
On Fri, Jan 6, 2012 at 6:56 PM, Mark S. Miller erig...@google.com wrote: On Fri, Jan 6, 2012 at 9:27 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: that whole variable can be redefined or used as communication channel ... I really don't understand what is the problem

Re: Improving Function.prototype.bind

2012-01-06 Thread Andrea Giammarchi
Maybe interesting for others too, since we talked about WeakMap a lot in this thread: My essential polyfill here: https://gist.github.com/1571878 100% code coverage here: https://gist.github.com/1571887 Best Regards, Andrea Giammarchi ___ es

Re: Improving Function.prototype.bind

2012-01-09 Thread Andrea Giammarchi
I would be more than happy to go on with libraries first approach as long as we don't have to wait 6 years before a needed feature is going to be considered. I have also raised the problem because it is in my opinion underestimated but mainly because I would like to avoid the fragmentation of

Re: Improving Function.prototype.bind

2012-01-09 Thread Andrea Giammarchi
indeed ... inline functions are problem number 2, anonymous or not, unless the removeEventListener is not performed inside the function itself so that at least the function name could be reused while if anonymous and use strict is in place there's no way to know which function is it. However, two

Re: Improving Function.prototype.bind

2012-01-09 Thread Andrea Giammarchi
just to make it more concrete for those interested: http://webreflection.blogspot.com/2012/01/introducing-objecthandler.html IDL Like description and code ... to me this is a much faster/easier/better solution than Function#bind ... unshimmable for IE 9 but ... you know, some wrapper could do

Re: Anonymous methods

2012-01-11 Thread Andrea Giammarchi
I believe when we talk about lambda here, we don't exactly mean addressable anonymous functions :-) # python lambda g = lambda x: x*x g(8) # 64 // JS lambda function lambda(exp) { var body = exp.split(:); return Function(body[0], return + body.slice(1).join(:)); } var g = lambda(x: x*x);

Re: Harmony modules feedback

2012-01-16 Thread Andrea Giammarchi
I have posted about a better approach to load modules too talking about an early state library that already works like a charm: http://webreflection.blogspot.com/2012/01/y-u-no-use-libraries-and-add-stuff.html AMD is good in theory but as far as I can see it fails miserably when it comes to JS

Re: Harmony modules feedback

2012-01-16 Thread Andrea Giammarchi
You are underlying my points too .. I am dealing on daily basis with highly dependent little modules and the build procedure takes care of packing everything together before deployment. However, we are using a synchronous version of require, similar to the one used in node.js but that does not

Re: Harmony modules feedback

2012-01-16 Thread Andrea Giammarchi
now I am ... thanks for those links, requires optimizer seems already good enough as cross-platform concept br On Mon, Jan 16, 2012 at 9:01 PM, Axel Rauschmayer a...@rauschma.de wrote: @Andrea, Mariusz: Are you aware of the RequireJS optimizer [1]? It can be used together with almond [2], an

Re: A different semantics for WeakMap#get default value

2012-01-16 Thread Andrea Giammarchi
I would also say that if you can carry both the keyObject and its defaultValue with you all the time you may not need at all to store it as weak map ... looks to me you are missing the point where the relation should be created, using the get() as generic action/entry point to do that. I believe

Re: A different semantics for WeakMap#get default value

2012-01-16 Thread Andrea Giammarchi
then the method should be called *getOrSetIfNotThere(obj, def)* 'cause get() would mislead too much looks to me we are also confusing falsy with undefined ... undefined is undefined and there's no reason to use a WeakMap to set undefined since I would expect the WeakMap itself to completely

Re: A different semantics for WeakMap#get default value

2012-01-16 Thread Andrea Giammarchi
it's OK, 'cause is not called get ;-) On Tue, Jan 17, 2012 at 1:46 AM, Kris Kowal kris.ko...@cixar.com wrote: On Mon, Jan 16, 2012 at 4:39 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: then the method should be called getOrSetIfNotThere(obj, def) 'cause get() would mislead too

ES6 Collections Polyfill

2012-01-17 Thread Andrea Giammarchi
Somebody may be interested into ES6 Map, WeakMap, and Set Here my attempt with all explanations: https://github.com/WebReflection/es6-collections The code must work in every browser/JS engine, reasons about weakness choice listed too. Now you know, feedbacks welcome br

Re: A different semantics for WeakMap#get default value

2012-01-19 Thread Andrea Giammarchi
On Thu, Jan 19, 2012 at 7:51 AM, Mark S. Miller erig...@google.com wrote: Everyone on this thread, is there any need expressed in this thread that is not satisfied by InfiniteMap? I would say for notification purpose result = lazyFactory(key, defaultValue); would be more appropriate

Re: A different semantics for WeakMap#get default value

2012-01-19 Thread Andrea Giammarchi
On Thu, Jan 19, 2012 at 6:11 PM, Mark S. Miller erig...@google.com wrote: That's not quite true in the collection I posted, since an InfiniteMap is only *initially* total. It still emulates deletes by using tombstones to poke holes into its initially universal domain. When doing a get at a

Re: Jan 18 meeting notes

2012-01-19 Thread Andrea Giammarchi
for all WeakMap shims and examples I have seen this to guard the key as object is basically: Object.isObject = function isObject() { return Object(value) === value; }; why such difference with indeed function ambiguity with your first example? Agreed on Object.type since it's easy to monkey

Re: Does private(expr) create a private storage block?

2012-01-19 Thread Andrea Giammarchi
On Fri, Jan 20, 2012 at 2:24 AM, Herby Vojčík he...@mailbox.sk wrote: Let the object created is foo. When calling foo.method(), it is accessing private(foo), not private(objectWithPrivates), since this is foo. If yes does not happen. Errors may happen since foo probably does not have private

Re: Jan 18 meeting notes

2012-01-19 Thread Andrea Giammarchi
+1 for the returned class ... also if we distinguish between array and Array then the new Boolean/Number/String case can be covered via Number, if object, rather than number, which is cool. Th only weird thing would be object rather than Object, as if its [[class]] is unknown br On Fri, Jan 20,

Re: Fixing instanceof (Array.isArray() etc.)?

2012-01-21 Thread Andrea Giammarchi
with postMessage and other standard/secure ways to pass data around the cross frame problem is slowly disappearing unless it's meant to sandbox the Array, as example, of that frame. A classic example is indeed the freedom to extend the way we like a sandboxed Array which hopefully will never

Re: Shouldn't timers be specified?

2012-01-22 Thread Andrea Giammarchi
process.nextTick already landed in browsers, as concept, it's called setImmediate http://msdn.microsoft.com/en-us/library/ie/hh673556(v=vs.85).aspx#setimmediate About Rhino, that implementation is not the equivalent of what we have in browsers, where the most useful thing ever is rarely used out

Re: Questions on Map and Set based on SpiderMonkey implementation

2012-01-22 Thread Andrea Giammarchi
random thoughts: it still looks weird to me to prefix undefined and null with object, plus there is no undefined [[class]], neither Null one so despite the good intention, I believe null, NaN, and undefined, should return [not an object] as well as primitives should return [primitive String] as

Re: Shouldn't timers be specified?

2012-01-22 Thread Andrea Giammarchi
var d = new Date, i = setInterval(function () {console.log(new Date - d); d = new Date;}, 1); most likely gonna fire a sequence of 10 0 11 0 12 0 10 0 11 0 10 0 ... not really reliable, even if delay is specified to 10 o 20, does not look that consistent with setTimeout, I have tried delay 3

Re: Non-extensible WeakMaps

2012-01-23 Thread Andrea Giammarchi
for what it's worth it ... Object.defineProperty(Object.prototype, new, {value: function (descriptor) { return Object.create(typeof this == function ? this.prototype : this, descriptor || {} ); }}); Map.new() and Math.new() should both work my 2 cents On Mon, Jan 23, 2012 at

Re: Augmenting Number.prototype with the functions from Math

2012-01-25 Thread Andrea Giammarchi
Number.prototype.pow = function pow(radix) { return Math.pow(this, radix); }; //alert(2.pow(3)); // error, decimal point, not property accessor alert(2..pow(3)); // 8 alert(NaN.pow(0)); // 1 until numbers are valid as digit. I don't see any advance on using Number.prototype for anything until

Re: Augmenting Number.prototype with the functions from Math

2012-01-26 Thread Andrea Giammarchi
my point was: no need to have pow in Number.prototype, imo On Thu, Jan 26, 2012 at 1:40 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Jan 25, 2012, at 3:47 PM, Andrea Giammarchi wrote: Number.prototype.pow = function pow(radix) { return Math.pow(this, radix); }; //alert(2.pow(3

Any plan for a Zlib API ?

2012-01-30 Thread Andrea Giammarchi
it's quite common to send a consistent amount of data in certain applications and the FORM does not scale here while an Ajax POST or an upload via binary gripped data would be handy. It would also be handy to store a bit more data in localStorage, Web SQL ( for those that won't drop it ) and/or

Re: Any plan for a Zlib API ?

2012-01-30 Thread Andrea Giammarchi
any sort of real time sharing editing/documentation document even to go (3G) plus I want to shrink those bloody 50Mb of Web SQL or 5Mb of localStorage limit ... 5Mb ain't nothing for data, we all know that, neither are 50, while native apps, talking about mobile, get as much as they want with a

Re: Any plan for a Zlib API ?

2012-01-31 Thread Andrea Giammarchi
it's great to have other developers with me but I wonder if anyone would be so kind to bring this at next TC39 meeting too, thanks ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Any plan for a Zlib API ?

2012-01-31 Thread Andrea Giammarchi
just an UP for this topic ... anyone with other thoughts ? cheers On Tue, Jan 31, 2012 at 2:18 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: any sort of real time sharing editing/documentation document even to go (3G) plus I want to shrink those bloody 50Mb of Web SQL or 5Mb

  1   2   3   4   5   6   7   8   9   10   >