Re: Object.mixin() reacher proposal

2013-04-14 Thread Andrea Giammarchi
updated API with Trait and the extra argument: https://github.com/WebReflection/object-mixin#api how does the code look like now: https://github.com/WebReflection/object-mixin/blob/master/src/object-mixin.js is your browser passing all tests? (if green, yes) http://webreflection.github.io/object-

Re: Object.mixin() reacher proposal

2013-04-14 Thread Andrea Giammarchi
not sure changing name is a thing to promote, it makes method name clashing easier but it can be achieved simply attaching properties to a specific object and then pass that as mixin ... Object.mixin(target, { on: source.addEventListener, off: source.removeEventListener, has: source.hasEvent

Re: A Precedent

2013-04-14 Thread Andrea Giammarchi
at least in Firefox is working like that: var blackMagic = Object.getOwnPropertyDescriptor( Object.prototype, '__proto__' ).set; var NaO = Object.create(null); var o = {}; blackMagic.call(NaO, o); o.isPrototypeOf(NaO); // true if this will work cross browser like this adopting a method rath

RE: A Precedent

2013-04-14 Thread Nathan Wall
Brendan Eich wrote: > ... https://mail.mozilla.org/pipermail/es-discuss/2013-February/028631.html > > It looks like the setter throws only if called on an object from a > different "realm", so maybe it will work for your intended uses. It > won't work cross-frame, in other words. > > /be Great!  W

Re: Object.mixin() reacher proposal

2013-04-14 Thread Peter Seliger
Hi, maybe one should discuss terminology first. What has been rediscovered within the last decade every now and again by JavaScript programming individuals, this languages capability for "functional or function based mixins", might deserve a closer look, before running into what I would call a met

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

2013-04-14 Thread Norbert Lindenberg
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 Sorin Mocanu > Thank you Nebojša. > How about if the [timezone] parameter would only be passed at the > construction of the Date object? That would (perhaps) allow a user to > c

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

2013-04-14 Thread Norbert Lindenberg
On Apr 9, 2013, at 11:30 , Nebojša Ćirić wrote: > We need to support conversion between: > {Y, M, D, H, M, S, AnyTimeZone*} <=> {UTC Epoch millis} > > *AnyTimeZone - doesn't have to be system one, supports IANA tz format. I proposed one direction of this mapping a while ago as "public API for

Re: Object.mixin() reacher proposal

2013-04-14 Thread Andrea Giammarchi
somebody already raised the concern "what if I want to mixin the function as object, not as callable" I think being [[Call]] not possible to mixin as object functionality, and being functions all by default having ownProperties such ["arguments", "name", "length", "caller"] .. that would simply cl

Re: Object.mixin() reacher proposal

2013-04-14 Thread Angus Croll
yeah that's better - I was having a senior moment - most constructor functions will normally reside in the prototype of course On Sun, Apr 14, 2013 at 1:59 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > My previous version was doing that in a probably too smart way so I've > simpl

Re: Object.mixin() reacher proposal

2013-04-14 Thread Andrea Giammarchi
My previous version was doing that in a probably too smart way so I've simplified the proposal simply accepting, in that example Object.mixin(Thung.prototype, Thing.proottype); Object.mixin(Thung.prototype, Thang.proottype); It does not look so black magic anymore but it's way less ambiguous than

Re: Object.mixin() reacher proposal

2013-04-14 Thread Angus Croll
Lending my support to Object.mixin accepting a function as the argument—but no surprise there I guess :) Note: since functional mixins and constructors are syntactically identical we can now get gorgeously expressive—and make type inheritance way simpler (for the first time allowing multiple type

Re: Object.mixin() reacher proposal

2013-04-14 Thread Andrea Giammarchi
right, I've simplified a lot and tested cross platform: https://github.com/WebReflection/object-mixin#object-mixin thoughts? On Sun, Apr 14, 2013 at 10:07 AM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > OK, maybe just code was a non-sense ... > > So, the idea behind is mark a fun

Re: Object.mixin() reacher proposal

2013-04-14 Thread Andrea Giammarchi
OK, maybe just code was a non-sense ... So, the idea behind is mark a function explicitly as mixin ... how ? Any function that is passed and has an empty prototype (then is user defined or native) could be considered invocable as mixin. function addFunctionality() { this.method = function () {

Re: Coordination (was: ES6 Modules)

2013-04-14 Thread Kevin Smith
> > I think I've taken us off into the weeds, and I apologize. What I was > trying to say is that library authors have an advantage over platform > authors, in that they can require other libraries. > No - this is good input. You want to be able to modularize your platform API, and not have to ha

Re: on caller descriptor

2013-04-14 Thread Andrea Giammarchi
generalizing means that for any generic object we should try/catch to avoid that error ? talking about automated code ... the "whitelist" is everyday bigger :) Thanks for the answer On Sun, Apr 14, 2013 at 8:07 AM, Rick Waldron wrote: > > > On Sunday, April 14, 2013, Andrea Giammarchi wrote: >

Re: Coordination (was: ES6 Modules)

2013-04-14 Thread Dirk Pranke
On Sat, Apr 13, 2013 at 4:52 PM, Kevin Smith wrote: > >> Put concretely: if Futures are provided via libraries, but you can't >> assume (require) libraries, then you can't design DOM APIs around Futures. >> Clearly, one way to solve this is put Futures into the language, but >> another is to solv

Re: on caller descriptor

2013-04-14 Thread Rick Waldron
On Sunday, April 14, 2013, Andrea Giammarchi wrote: > I wonder if all of this is expected: > > (function(){ > "use strict"; > function caller() { > alert(caller.caller); > } > // error if invoked: caller(); > // but showing up in properties > var properties = Object.getOwnPropertyN

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

2013-04-14 Thread David Bruant
Le 13/04/2013 09:31, Andreas Rossberg a écrit : On 13 April 2013 00:12, Brandon Benvie wrote: 3.) A new type of primitive along with a new type of wrapper. In this case we use the String/Number/Boolean precedent where `Symbol()` and `new Symbol()` produce different kinds of results. The problem

Re: Object.mixin() reacher proposal

2013-04-14 Thread Andrea Giammarchi
also, in case you are guessing the typo .. reacher because it could reach more (older) engines, doing a joke with richer got it? .. too damn fun, I know! On Sun, Apr 14, 2013 at 2:04 AM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > apologies > getOwnPropertyDescriptor( > so

Re: Object.mixin() reacher proposal

2013-04-14 Thread Andrea Giammarchi
apologies getOwnPropertyDescriptor( source, key ) should have been getOwnPropertyDescriptor( enricher, key ) On Sun, Apr 14, 2013 at 1:58 AM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > what I've written here: > > https://github.com/WebReflection/object-mixin/blob/

Object.mixin() reacher proposal

2013-04-14 Thread Andrea Giammarchi
what I've written here: https://github.com/WebReflection/object-mixin/blob/master/src/object-mixin.js is a better proposal for the potential `Object.mixin()` in current ES6 specs. It seems that Mixins Are Awesome and this can take most advantages from being a function and not only an object: http

on caller descriptor

2013-04-14 Thread Andrea Giammarchi
I wonder if all of this is expected: (function(){ "use strict"; function caller() { alert(caller.caller); } // error if invoked: caller(); // but showing up in properties var properties = Object.getOwnPropertyNames(caller); if (properties.indexOf('caller')) { console.log(JSON