Re: Enriched Descriptors, maybe ES7 ?

2014-03-10 Thread Tom Van Cutsem
2014-03-09 21:05 GMT+01:00 Brendan Eich bren...@mozilla.com: Tom has experimented, IIRC. I don't know which implementations preserve extended property descriptor properties. As Allen mentioned earlier, proxies should receive in their defineProperty trap the full descriptor object as it was

Re: Enriched Descriptors, maybe ES7 ?

2014-03-10 Thread David Bruant
Le 10/03/2014 08:02, Tom Van Cutsem a écrit : Using Firefox's built-in direct proxies implementation I get a TypeError. I'll investigate further and file a bug. You already did https://bugzilla.mozilla.org/show_bug.cgi?id=601379 ;-) David ___

Re: Enriched Descriptors, maybe ES7 ?

2014-03-10 Thread Andrea Giammarchi
Thanks Tom, I see what you mean but using proxies is a performance killer, while I am trying to propose something that theoretically could also give a performance boost. I am not proposing custom descriptor attributes here, I am proposing `type`, `arguments` (or `parameters`) and `returns` as

Re: Enriched Descriptors, maybe ES7 ?

2014-03-10 Thread Tom Van Cutsem
2014-03-10 11:10 GMT+01:00 David Bruant bruan...@gmail.com: Using Firefox's built-in direct proxies implementation I get a TypeError. I'll investigate further and file a bug. You already did https://bugzilla.mozilla.org/show_bug.cgi?id=601379 ;-) Thanks for refreshing my memory on that one

Re: Enriched Descriptors, maybe ES7 ?

2014-03-09 Thread Allen Wirfs-Brock
Note that ES6 proxies as specified permits Object.defineProperty/getOwnPropertyDescriptor to pass custom attributes in property descriptors and even passes them along (not sure if anybody has actually implemented this yet) wherever there is a internal get descriptor/set descriptor sequence.

Re: Enriched Descriptors, maybe ES7 ?

2014-03-09 Thread Andrea Giammarchi
my quick tests say no implementation does, all seem to create from the scratch a new object with only known/described descriptor properties. ```javascript Object.getOwnPropertyDescriptor( Object.defineProperty( {},'test',{value:123,type:'number'} ), 'test' ).type // undefined ``` I'd

Re: Enriched Descriptors, maybe ES7 ?

2014-03-09 Thread Brendan Eich
Andrea Giammarchi wrote: I'd love to know more about Tom experiments on this! With his polyfill on the original proxy implementation, now that I think about it. https://github.com/tvcutsem/harmony-reflect but originally http://es-lab.googlecode.com/svn/trunk/src/proxies/DirectProxies.js

Re: Enriched Descriptors, maybe ES7 ?

2014-03-09 Thread Andrea Giammarchi
Uhm .. that looks just like Proxy and descriptors with known specd properties ... might wait for Tom to know if he had anything to do with types and custom properties in descriptors too. Although my idea is more about types and less about proxies or descriptors themselves, these are fine as they

Re: Enriched Descriptors, maybe ES7 ?

2014-03-09 Thread Brendan Eich
Andrea Giammarchi wrote: Although my idea is more about types You are starting on the wrong foot there. Types mean something in CS. Best if you start with use-cases instead of abusing the term. What code do you want to write, and how exactly would it operate? /be

Re: Enriched Descriptors, maybe ES7 ?

2014-03-09 Thread Andrea Giammarchi
As written before, and explained in the project, I can write descriptors with optional extra properties such as: **type**, describing as string the typeof, as Function the expected instanceof, or as generic object as prototypeOf(expectedType) ```javascript var o = {}; Object.defineProperty(o,

Re: Enriched Descriptors, maybe ES7 ?

2014-03-09 Thread Andrea Giammarchi
about the first example, I forgot the writable for the num property so please read that as if I wrote: ```javascript var o = {}; Object.defineProperty(o, 'num', { writable: true, value: 0, type: 'number' }); ``` the library makes possible to create a partial shim of StructType in few lines

Re: Enriched Descriptors, maybe ES7 ?

2014-03-09 Thread Andrea Giammarchi
last link is [the test file]( https://github.com/WebReflection/define-strict-properties/blob/master/test/define-strict-properties.js) which better than examples in here describes what happens when the library is around, how ES5 descriptors can guard properties and methods within objects or

Enriched Descriptors, maybe ES7 ?

2014-03-08 Thread Andrea Giammarchi
Yesterday, after my DHTMLConf talk, some developer asked me to present/propose my idea about introducing **optional** types in an ES5 compatible way. Here a quick overview of properties which aim is to guard types or methods signatures, compatible with overloads for both number of arguments, and