Re: Array.prototype.find

2013-06-07 Thread Andrea Giammarchi
yep, I followed Jussi ... it's his fault :P sorry I misunderstood too On Fri, Jun 7, 2013 at 7:03 AM, Jussi Kalliokoski < jussi.kallioko...@gmail.com> wrote: > Oops, my bad, sorry about that. > On Jun 7, 2013 3:37 AM, "Axel Rauschmayer" wrote: > >> Note: the proposed new parameter is `returnV

Object.values and/or Object.forEach ?

2013-06-07 Thread Andrea Giammarchi
it comes out from time to time devs would like to have `Object.values()` as equivalent of `Object.keys()` except the returned array would contain values. Better than repeated `Object.keys(obj).map(function(p){return this[k];}, obj);` all over but probably less useful than a more generic `Object.f

Re: Object.values and/or Object.forEach ?

2013-06-07 Thread Andrea Giammarchi
would this 'polyfill' as expected or there's more about these helpers ? ```javascript this['@dict'] = { keys: Object.keys, values: function(keys){ function map(key) { return this[key]; } return function values(obj) { return keys(obj).map(map, obj); }; }(Object.key

Re: Is __proto__ ready needed?

2013-06-10 Thread Andrea Giammarchi
yep, that's awesome ... too bad not a single engine exposed yet such easy change ever for both V8 and/or SpiderMonkey since everything is already in place, only the public method exposed to JS is missing (and for V8 I've already porposed a patch to drop the poison pill but nothing happened ...) I

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

2013-06-11 Thread Andrea Giammarchi
I believe Iterator should be an interface and not a class so I could extend Array or ArrayLike implementing Iterator, when/if necessary, in order to have a for/of compatible class. We don't have interfaces ... I know, we could have mixins though, compatible with @@things too. My 2 cents On Tue,

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

2013-06-11 Thread Andrea Giammarchi
13 at 11:01 AM, Allen Wirfs-Brock wrote: > > On Jun 11, 2013, at 10:22 AM, Andrea Giammarchi wrote: > > I believe Iterator should be an interface and not a class so I could > extend Array or ArrayLike implementing Iterator, when/if necessary, in > order to have a for/of compatible cl

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

2013-06-11 Thread Andrea Giammarchi
On Tue, Jun 11, 2013 at 1:26 PM, Brian Di Palma wrote: > Sorry for the OT message. > > On Tue, Jun 11, 2013 at 6:22 PM, Andrea Giammarchi > wrote: > > We don't have interfaces ... I know, we could have mixins though, > compatible > > with @@things too. >

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

2013-06-11 Thread Andrea Giammarchi
2013 at 5:48 PM, Dmitry Soshnikov < dmitry.soshni...@gmail.com> wrote: > > On Tue, Jun 11, 2013 at 5:33 PM, Brendan Eich wrote: > >> Brian Di Palma wrote: >> >>> Sorry for the OT message. >>> >>> On Tue, Jun 11, 2013 at 6:22 PM, Andrea Giammarch

Re: Object.mixin( source, target ) | arguments changed

2013-06-13 Thread Andrea Giammarchi
The fact it has been proposed as "mixin" method is a sign too ... is like saying that `class` in JS is wrong because classical inheritance meant in other language is not exactly the same in JS. It would be nice to focus on the signature and finalize that in the spec instead of raising every now an

Re: Object.mixin( source, target ) | arguments changed

2013-06-13 Thread Andrea Giammarchi
Rick talked about a third argument but if that won't exist I like multiple sources too. It's also more suitable as Object.mixin(target, ...[source1, source2, source3]) for predefined collections of mixins to reuse +1 here On Thu, Jun 13, 2013 at 3:57 PM, Dmitry Soshnikov < dmitry.soshni...@gmai

Re: Object.mixin( source, target ) | arguments changed

2013-06-13 Thread Andrea Giammarchi
Peter Seliger wrote: > If one thinks about how Andrea Giammarchi might have come up > with his already reliable implementation of [Object.mixin] ... > > [ > https://github.com/WebReflection/object-mixin/blob/master/src/object-mixin.js > ] > > ... the need for changing the ord

Re: Automatically binding extracted methods

2013-06-14 Thread Andrea Giammarchi
I think that's possible since "the beginning of the time" ... we just need to be a bit more pragmatic with what's available. Examples here: http://webreflection.blogspot.com/2012/11/my-name-is-bound-method-bound.html summarized as ```javascript Generic.prototype.bound = function (methodName) {

Re: Array.prototype.values() compatibility hazard

2013-06-18 Thread Andrea Giammarchi
can you try to hot-fix that via `with(values.values=values)` ? On Tue, Jun 18, 2013 at 2:59 PM, Brandon Benvie wrote: > On 6/17/2013 6:30 PM, Brandon Benvie wrote: > >> On 6/17/2013 4:33 PM, Jason Orendorff wrote: >> >>> Firefox added Array.prototype.values() and immediately ran into >>> compat

Re: Array.prototype.values() compatibility hazard

2013-06-18 Thread Andrea Giammarchi
scape. And so, ultimately, > myself. > > /be > > Allen Wirfs-Brock wrote: > >> On Jun 18, 2013, at 3:05 PM, Brandon Benvie wrote: >> >> On 6/18/2013 3:02 PM, Andrea Giammarchi wrote: >>> >>>> can you try to hot-fix that via `with(values.values=va

Re: On IE __proto__ test cases

2013-07-08 Thread Andrea Giammarchi
on 3.1.1-10 AFAIK `Object.preventExtension({})` makes __proto__ immutable. Since `Object.freeze({})` includes that `preventExtension` call, immutable should be so no `y` inherited there. On Thu, Jul 4, 2013 at 3:10 PM, David Bruant wrote: > Hi, > > So, there are standard tests now for ES6! > ht

Object#extra hazard

2013-07-10 Thread Andrea Giammarchi
Just a humble attempt to propose some addiction to the `Object.prototype` I already know many will kill me for even trying to ... **tl;dr** - everything proposed can be already tested through this utility called [eddy.js](https://github.com/WebReflection/eddy#event-driven-js) ### Event Target All

Re: Object#extra hazard

2013-07-10 Thread Andrea Giammarchi
my implementation works already with `DOM` nodes and browser environment, including `window`. I've also already written an `EventTarget` mixin object but in my case I'd use that via `Object.mixin(Object.prototype, EventTarget);` 'cause almost every object I use in my logic should be observed or sh

Re: Object#extra hazard

2013-07-10 Thread Andrea Giammarchi
{}, > on type3(){} > }) > > obj.{ > on type1(){}, > on type2(){}, > on type3(){} > } > > obj := { > on type1(){}, > on type2(){}, > on type3(){} > } > > > On Wed, Jul 10, 2013 at 12:41 PM, Andrea Giammarchi < > andrea.giammar...@gmail.

Re: Creating your own errors

2013-07-10 Thread Andrea Giammarchi
I am not sure where this conversation ended up so I hope I am not repeating already said stuff but you can always create constructors that inherits from Error and set the name. ```javascript function CustomError(message) { this.message = message || ''; } CustomError.prototype = new Error; Custom

Re: Creating your own errors

2013-07-10 Thread Andrea Giammarchi
yep, I thought it was about having meaningful red errors with a proper name in console. The stack can be addressed passing the `new CustomError (new Error('message'))` using error as argument, not big deal ... abusing __proto__ for this seems like the wrong answer to a concrete problem On Wed, Ju

Re: Object#extra hazard

2013-07-10 Thread Andrea Giammarchi
inline ... On Wed, Jul 10, 2013 at 3:57 PM, Rick Waldron wrote: > I don't want any of this on my Object objects. Not all objects represent > something that can or should emit/publish/trigger/broadcast. > > For example... > > class Light { > constructor() { > // initialize Light control ins

Re: Object#extra hazard

2013-07-10 Thread Andrea Giammarchi
t want >> Object.prototype.* and Object.* to suffer the same way that the [[Global]] >> (window) object in browsers has suffered. Give a hoot, don't pollute. >> >> Post ES6 world makes creating emitter objects trivial—so why not a >> blessed standard lib module that can

Re: Creating your own errors

2013-07-10 Thread Andrea Giammarchi
wrong at least two things for the non ES6 version 1. `Error.call(this, message)` does not do what you think it should do 2. `CustomError.prototype = Object.create(Error)` has a typo, you meant ` Object.create(Error.prototype)` In the ES6 version, I am not sure about constructors and classes, bu

Re: Object#extra hazard

2013-07-10 Thread Andrea Giammarchi
o extends EventEmitter {} > // or > class Foo extends EddyEmitter {} > // etc. > > This, IMO, is *far* more favorable and *far* less obtrusive (and already > in the works). > > On Wed, Jul 10, 2013 at 7:27 PM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote:

Re: Object#extra hazard

2013-07-10 Thread Andrea Giammarchi
On Wed, Jul 10, 2013 at 6:16 PM, Rick Waldron wrote: > > I absolutely stand by championing such a standard module. > > then I stop here waiting for other opinions about championing an Emitter mixin/module/constructor in core. best regards ___ es-discuss

Re: Creating your own errors

2013-07-10 Thread Andrea Giammarchi
oh well ... I've missed the part when you guys decided that inherited defaults are useless as properties ... :-/ as you said, inconvenient, and not only this case ... also good to know ^_^ On Wed, Jul 10, 2013 at 4:56 PM, Allen Wirfs-Brock wrote: > > On Jul 10, 2013, at 4:32

Re: Object#extra hazard

2013-07-11 Thread Andrea Giammarchi
then if it where a simple string. > > > On Thu, Jul 11, 2013 at 2:37 AM, Rick Waldron > wrote: > > > > > > > > On Wed, Jul 10, 2013 at 9:31 PM, Andrea Giammarchi > > wrote: > >> > >> On Wed, Jul 10, 2013 at 6:16 PM, Rick Waldron > >

Re: Object#extra hazard

2013-07-11 Thread Andrea Giammarchi
On Thu, Jul 11, 2013 at 2:32 PM, Rick Waldron wrote: > > > > On Thu, Jul 11, 2013 at 4:45 PM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> I would simplify saying that symbols can be used as well as strings ? I >> don't see any usefulness

Maps and Sets, goodbye polyfill ?!

2013-07-11 Thread Andrea Giammarchi
I've noticed by accident Maps and Sets (simple?) now uses generators so that no polyfill will ever work anymore and Sets are pointless since there's no way to retrieve back values in any shim. I'll drop my es6-collections polyfill and take care of a pointless WeakMap shim only at this poit ... won

Re: Maps and Sets, goodbye polyfill ?!

2013-07-11 Thread Andrea Giammarchi
derstand the question. Could you expand, and provide > more links to relevant background? Thanks. > > > On Thu, Jul 11, 2013 at 3:31 PM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> I've noticed by accident Maps and Sets (simple?) now uses gener

Re: Maps and Sets, goodbye polyfill ?!

2013-07-11 Thread Andrea Giammarchi
at is missing ... if you don't need to hold why on earth that page shows *values() *keys() and *items() ? iterable is the only one that **might** make sense, imho br On Thu, Jul 11, 2013 at 3:40 PM, Allen Wirfs-Brock wrote: > > On Jul 11, 2013, at 3:31 PM, Andrea Giammarchi wrote: >

Re: Maps and Sets, goodbye polyfill ?!

2013-07-11 Thread Andrea Giammarchi
o polyfill ... which is not. The polyfill gonna grow in size for no concrete reason now, can I at least ask if current specs about Maps, Sets, and WeakMaps are final? Thanks On Thu, Jul 11, 2013 at 3:49 PM, Tab Atkins Jr. wrote: > On Thu, Jul 11, 2013 at 3:44 PM, Andrea Giammarchi > w

Re: Maps and Sets, goodbye polyfill ?!

2013-07-11 Thread Andrea Giammarchi
Rick, that big bold thing is what mislead to me ... *This proposal* I thought was referred to the page, the one showed in that page ... On Thu, Jul 11, 2013 at 4:32 PM, Rick Waldron wrote: > > > > On Thu, Jul 11, 2013 at 7:06 PM, Andrea Giammarchi < > andrea.giammar..

Re: Maps and Sets, goodbye polyfill ?!

2013-07-11 Thread Andrea Giammarchi
) Anyway, problem solved: harmony pages and examples in them are outdated. On Thu, Jul 11, 2013 at 4:33 PM, Tab Atkins Jr. wrote: > On Thu, Jul 11, 2013 at 4:06 PM, Andrea Giammarchi > wrote: > > yes, I should have checked the specs but that page should be either > updated

Re: Maps and Sets, goodbye polyfill ?!

2013-07-11 Thread Andrea Giammarchi
ou think that's "unmistakenable" fine, I've learned some better english today too. regards On Thu, Jul 11, 2013 at 4:39 PM, Rick Waldron wrote: > > > > On Thu, Jul 11, 2013 at 7:34 PM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> R

Re: Maps and Sets, goodbye polyfill ?!

2013-07-11 Thread Andrea Giammarchi
thank you On Thu, Jul 11, 2013 at 5:02 PM, Rick Waldron wrote: > > > > On Thu, Jul 11, 2013 at 7:43 PM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> The proposal in this page is outdated and the formal one has progressed >> to ... etc etc ..

Re: Maps and Sets, goodbye polyfill ?!

2013-07-11 Thread Andrea Giammarchi
On Thu, Jul 11, 2013 at 5:02 PM, Brandon Benvie wrote: > > // ES6 > function* entries(obj){ > for (let key in obj) { > yield [key, obj[key]]; > } > } > cool, but why do we need that exactly ? > > // ES3-5 version > function entries(obj){ > var keys

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

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: JS Ctypes

2013-07-12 Thread Andrea Giammarchi
e mixed up with structs > and scalar/SIMD-vector types. It's also not "awesome" because unsafe. > > /be > > Andrea Giammarchi wrote: > >> I wonder if there is any interest/plan/scheduled TC39 slot about JS >> Ctypes, mentioned by [Brendan Eich in hi

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: JS Ctypes

2013-07-12 Thread Andrea Giammarchi
d value objects cover the "fast typed structs/primitives". > > Unsafe FFI is a different issue and should not be mixed up with structs > and scalar/SIMD-vector types. It's also not "awesome" because unsafe. > > /be > > Andrea Giammarchi wrote: > >>

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: 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 e

Re: Maps and Sets, goodbye polyfill ?!

2013-07-13 Thread Andrea Giammarchi
you know what's funny? VBScript had static/fixed classes and immutable objects in 1999 and goddammit nobody ever thought that was cool! I've also proposed [static/fixed/frozen classes]( https://code.google.com/p/vbclass/) a while ago and also asked why `Object.freeze({})` makes the object slower,

Re: Why is .bind so slow?

2013-07-13 Thread Andrea Giammarchi
ded! Regards On Sat, Jul 13, 2013 at 12:39 PM, Mark S. Miller wrote: > Arrow functions, whether strict or non-strict, are not supposed to have > their own |arguments| > > > On Sat, Jul 13, 2013 at 11:55 AM, Jeff Walden wrote: > >> On 07/12/2013 04:59 PM, Andrea Giammarch

Re: Why is .bind so slow?

2013-07-13 Thread Andrea Giammarchi
pretty well for performance ... although the prototype would be even more messed up ... On Sat, Jul 13, 2013 at 9:47 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > this makes more sense than `callee` since `.bind()` functions are slow > even in `"use strict"` scen

Re: 12["__proto__"]

2013-07-17 Thread Andrea Giammarchi
you might want to double check `Object.getPrototypeOf(generic)` does the same as `Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').get.call(generic)`. Apologies if this is already the case. off topic: any idea when `Object.setPrototypeOf(generic, proto)` will be rolled out and __pro

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

2013-07-23 Thread Andrea Giammarchi
FWIW, I d0On't like it neither On Tue, Jul 23, 2013 at 12:04 PM, Jeff Walden wrote: > var n = 0O755; > > Is this something anyone wants to read? I certainly don't! Allowing only > lowercase 'o' in octal literal syntax is inconsistent with 'x' and 'b', but > on balance I think that's probably

Re: Let this object of global environment be specified by host

2013-07-24 Thread Andrea Giammarchi
is this out of another discussion or it's me not understanding the context, the what, the where, and the why about such topic? Thanks for any clarification On Wed, Jul 24, 2013 at 8:11 AM, Anne van Kesteren wrote: > Currently HTML overrides the ES standard here to set the this object > to Windo

Re: Array.prototype.last

2013-07-29 Thread Andrea Giammarchi
reasons I've suggested a getter is the affinity with DOM indeed while for the "Object redefinition" part looks basically what I've simulated here: https://github.com/WebReflection/another-js#anotherjs-api able to use emulated reflection too. Didn't know about Allen proposal, cool stuff! On Sun,

Re: Agreeing on user-defined unique symbols?

2013-07-31 Thread Andrea Giammarchi
unique string (uuid or otherwise) suffer same problem if generated in 2 different realm unaware of each other. In any case, as mentioned before, this is very similar to instanceof or isPrototypeOf/getPrototypeOf and I don't see many concrete real cases problems except being able to serialize and d

Re: Agreeing on user-defined unique symbols?

2013-07-31 Thread Andrea Giammarchi
for what is worth it, this worked quite well in a single realm with no enumerability though: https://gist.github.com/WebReflection/5238782#file-gistfile1-js-L1 // example var sym = new Symbol; var o = {}; o[sym] = 123; console.log(o[sym]); On Wed, Jul 31, 2013 at 10:49 AM, Brendan Eich wrote:

Re: setImmediate

2013-08-08 Thread Andrea Giammarchi
tl;dr - I would simply fix `setTimeout 0` ^_^ long story long: from a suer perspective, I never understood why `setTimeout(fn, 0, arguments)` does not act as `setImmediate(fn, arguments)` where latter one is apparently needed to indeed replace a misleading behavior with first `setTimeout` "broken"

Some Typed Objects Confusion

2013-08-20 Thread Andrea Giammarchi
[In this page](http://wiki.ecmascript.org/doku.php?id=harmony:typed_objects), and in the latest meeting note too, I can read both uint8 and Uint8, as example. Same if for all other types included `boolean`, and `string`, where these are historically `typeof variable` without meaning variable is `i

Re: Some Typed Objects Confusion

2013-08-20 Thread Andrea Giammarchi
Awesome, thanks! On Tue, Aug 20, 2013 at 4:12 PM, David Herman wrote: > On Aug 20, 2013, at 1:31 PM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > > > [In this page]( > http://wiki.ecmascript.org/doku.php?id=harmony:typed_objects), and in the > latest m

Re: Some Typed Objects Confusion

2013-08-20 Thread Andrea Giammarchi
to ES5 compatible polyfill since I believe your code won't run anywhere except in SpiderMonkey (which is OK but it's not suitable for a lightweight migration to "structure like" logic) Thanks. On Tue, Aug 20, 2013 at 4:55 PM, Andrea Giammarchi < andrea.giammar...@gmail

Re: Some Typed Objects Confusion

2013-08-20 Thread Andrea Giammarchi
sorry, point 3 was actually the question about point 2 On Tue, Aug 20, 2013 at 6:20 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > Uhm, just a couple of extra question about that page if/when you have time: > >1. string and boolean are mentioned, but

Re: Some Typed Objects Confusion

2013-08-21 Thread Andrea Giammarchi
verything in the proposal. > > Thanks, > Dmitry > > > > On Wed, Aug 21, 2013 at 3:21 AM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> sorry, point 3 was actually the question about point 2 >> >> >> On Tue, Aug 20, 2013 at 6:20

Re: Binary Data types in window context (was Some Typed Objects Confusion)

2013-08-21 Thread Andrea Giammarchi
at 4:21 AM, Dmitry Lomov wrote: >>> >>>> string, boolean, object and any are all lowercase (we should fix the >>>> wiki) >>>> >>>> FWIW, I am already working on a new version of polyfill. It is fully >>>> ES5. &

Re: Binary Data types in window context (was Some Typed Objects Confusion)

2013-08-21 Thread Andrea Giammarchi
I lie it => I like it (and not a lie at all) On Wed, Aug 21, 2013 at 10:55 AM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > to be honest I thought those were Symbols rather than some type/brand > representation and as "symbols" I've shimmed them to

Re: Binary Data types in window context (was Some Typed Objects Confusion)

2013-08-21 Thread Andrea Giammarchi
21, 2013 at 4:21 AM, Dmitry Lomov > wrote: > >> string, boolean, object and any are all lowercase (we should fix the > wiki) > >> > >> FWIW, I am already working on a new version of polyfill. It is fully > ES5. > >> Here is a pull request: https://githu

Re: Some Typed Objects Confusion

2013-08-21 Thread Andrea Giammarchi
t; wiki) >> > >> > FWIW, I am already working on a new version of polyfill. It is fully >> ES5. >> > Here is a pull request: https://github.com/dherman/structs.js/pull/12- >> > I'll merge it soon, and work more to cover everything in the proposal. >> &g

Re: Some Typed Objects Confusion

2013-08-21 Thread Andrea Giammarchi
l lowercase (we should fix the > wiki) > > > > > > FWIW, I am already working on a new version of polyfill. It is fully > ES5. > > > Here is a pull request: https://github.com/dherman/structs.js/pull/12- > > > I'll merge it soon, and work more to cover e

Re: Keywords as method names

2013-08-21 Thread Andrea Giammarchi
`window.if = boom;` if you really want to ... otherwise feel free to mess up with a `with({if:yourFunc}){}` block ^_^ On Wed, Aug 21, 2013 at 4:13 PM, Jason Orendorff wrote: > The ES6 draft says: > > MethodDefinition : PropertyName ( StrictFormalParameters ) { > FunctionBody } > Propert

Re: Some Typed Objects Confusion

2013-08-21 Thread Andrea Giammarchi
I agree lower ALL the cases is a win ... also because `boolean`, `string`, and `object`, aren't reserved words while function obviously is so with current proposal where `object` means `function` too and `any` includes null there's nothing ambiguous and less to bother about references. On Wed, Au

Re: Letting RegExp method return something iterable?

2013-08-26 Thread Andrea Giammarchi
you don't need to reset the `lastIndex` to zero if you don't break the loop before unless you are sharing that regexp with some other part of code you don't control. What I am saying is that the example is very wrong as it is since there's no way to have an unsafe `regexES5` behavior in there. Mo

Re: Letting RegExp method return something iterable?

2013-08-26 Thread Andrea Giammarchi
3 AM, Erik Arvidsson wrote: > On Mon, Aug 26, 2013 at 1:05 PM, Andrea Giammarchi > wrote: > > > Long story short, I don't see any real use/case or any concrete advantage > > with those examples so please make it more clear what's the problem you > are > > try

Re: Letting RegExp method return something iterable?

2013-08-26 Thread Andrea Giammarchi
```javascript {let m; while(m = re.exec(str)) { // ... no, really }} ``` I don't get the need of this but if this is the trend then String#split needs an iterable too (no!) On Mon, Aug 26, 2013 at 4:23 PM, Brendan Eich wrote: > Andrea Giammarchi wrote: > >> Is it very u

Re: Letting RegExp method return something iterable?

2013-08-26 Thread Andrea Giammarchi
oint: > > - as it stands, writing this kind of code tends to be bug prone (i.e. > people get it wrong in confusing ways) > - it would be less bug prone if there was just a method that returned an > iterable. That _could_ be an Array, rather than a lazy collection. > >

Re: Letting RegExp method return something iterable?

2013-08-26 Thread Andrea Giammarchi
one lazy hilarious thought on that though ... On Mon, Aug 26, 2013 at 5:30 PM, Forbes Lindesay wrote: > `String#split` already is iterable because it returns an array. What it > isn't is **lazy**. > > > > it's straight forward to make String#split

Re: Letting RegExp method return something iterable?

2013-08-27 Thread Andrea Giammarchi
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 wrote: > > Le 27 août 2013 à 01:23, Brendan Eich a écrit : > > > Andrea Giammarchi wr

Re: Letting RegExp method return something iterable?

2013-08-27 Thread Andrea Giammarchi
with "Don’t be clever, don’t make me think." a point which also I don't understand (I have to think about such statement ... I don't demand Ocaml language to be C like 'cause I don't get it) Anyway, I've already commented my point of view. Regards On Tue, Au

Re: Letting RegExp method return something iterable?

2013-08-27 Thread Andrea Giammarchi
at 9:42 AM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > > sure you know everything as soon as you read `of` ... right ? > > > Wrong. The nested assignment is idiomatic in C but not good for everyone > (see gcc's warning when not parenthesized in s

Re: Letting RegExp method return something iterable?

2013-08-28 Thread Andrea Giammarchi
On Wed, Aug 28, 2013 at 2:12 AM, Forbes Lindesay wrote: > a simple way to loop over the list of matches for a regular expression it's about 10 years or more we have that .. so to make my very personal statement clear: I've got 99 problems in JS, make everything an iterator ain't one Specially

Re: `.toArray()` for all generators

2013-08-28 Thread Andrea Giammarchi
I completely agree with Rick plus this is what I meant in the other thread when I've said I don't see the urge/need to deal with Iterators => Arrays if not ending up with waste of resources as the one proposed here. Somebody will need to write specs, tests, and implementations while we have all po

Re: RegExp. quoteText()

2013-08-28 Thread Andrea Giammarchi
quick one: the hyphen has meaning only inside squared brackets and between ranges ... this has no meaning `[_-]` so doesn't this `[a-]` On Wed, Aug 28, 2013 at 9:23 AM, Claude Pache wrote: > > Le 28 août 2013 à 17:23, Axel Rauschmayer a écrit : > > This must have been suggested before, but it

Re: `.toArray()` for all generators

2013-08-29 Thread Andrea Giammarchi
plus any time you want you can `GenericPrototype.toArray = function(){return Array.from(this)};` ... no need to put in specs your C# flavor, somebody else Python flavor, Ruby, Java, or Haskell ... JS would look like the tower of babel ^_^ note: it kinda does already in specs V6 and early 7 On Th

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Andrea Giammarchi
then you are probably looking for something like this? ```javascript String.prototype.matchAll = function (re) { for (var re = new RegExp( re.source, "g" + (re.ignoreCase ? "i" : "") + (re.multiline ? "m" : "") ), a = [], m; m = re.exec(this); a.push(m

Array subclasses and concat() ?

2013-09-09 Thread Andrea Giammarchi
In latest ES6 draft I can read this change: - Array.prototype.map, filter, slice, splice when used iwth array subclasses creates results arrays of the same subclass which is good/cool/eventually/hoooray **but** something that has been problematic since ever in subclassing Array in JS is Ar

Re: Array.prototype.slice web-compat issue?

2013-09-10 Thread Andrea Giammarchi
s a welcome thing but does not seem to be that practical as specced now considering existing code. On Tue, Sep 10, 2013 at 10:46 AM, Allen Wirfs-Brock wrote: > > On Sep 10, 2013, at 10:37 AM, Andrea Giammarchi wrote: > > > AFAIK 99% of libraries out there believe that slice.cal

Re: Array.prototype.slice web-compat issue?

2013-09-10 Thread Andrea Giammarchi
can be used. Thoughts? On Tue, Sep 10, 2013 at 12:25 PM, Allen Wirfs-Brock wrote: > > On Sep 10, 2013, at 11:12 AM, Andrea Giammarchi wrote: > > > As short answer, let me reformulate: > > AFAIK 99% of libraries out there believe that slice.call will return an > Arra

Re: Array.prototype.slice web-compat issue?

2013-09-10 Thread Andrea Giammarchi
I see one of two problems mentioned in my other topic is already discussed here so I'd like to add this question that will most likely break the web: 1. will `[].slice.call(arguments)` produce a pointless instanceof Arguments ? 2. will `[].slice.call(document.querySelectorAll('*'))` produce an

Re: Array.prototype.slice web-compat issue?

2013-09-10 Thread Andrea Giammarchi
ayObject.prototype.slice = function () { return Object.setPrototypeOf( Array.prototype.slice.call(this, arguments), Object.getPrototypeOf(this) ); }; ``` Cheers On Tue, Sep 10, 2013 at 3:24 PM, Rick Waldron wrote: > > > > On Tue, Sep 10, 2013 at 1:37 PM, Andrea Gi

Re: Array.prototype.slice web-compat issue?

2013-09-10 Thread Andrea Giammarchi
gt; > > > > On Tue, Sep 10, 2013 at 1:37 PM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> I see one of two problems mentioned in my other topic is already >> discussed here so I'd like to add this question that will most likely break >>

Re: Array.prototype.slice web-compat issue?

2013-09-10 Thread Andrea Giammarchi
... apply for gosh sake ... ```javascript function ArrayObject() {} ArrayObject.prototype.slice = function () { return Object.setPrototypeOf( Array.prototype.slice.apply(this, arguments), Object.getPrototypeOf(this) ); }; ``` On Tue, Sep 10, 2013 at 3:42 PM, Andrea Giammarchi

Re: Array.prototype.slice web-compat issue?

2013-09-10 Thread Andrea Giammarchi
yObject; a.push(1, 2, 3); a.slice() instanceof ArrayObject; // true ``` br On Tue, Sep 10, 2013 at 4:32 PM, Allen Wirfs-Brock wrote: > > On Sep 10, 2013, at 4:11 PM, Andrea Giammarchi wrote: > > > Rick I think I've often seen this which is not that naive accordingly > with

Re: Array.prototype.slice web-compat issue?

2013-09-10 Thread Andrea Giammarchi
Allen if you put the word `Array` but you define it differently then maybe it's not me misunderstanding ... Float32Array is not an Array in current ES, that's "fun enough" if you ask me. In any case, if that was the problem, being an Array, the solution is quite simple (recycling code, could be be

Re: Preserving arity in function wrappers

2013-09-16 Thread Andrea Giammarchi
when I've seen this ... On Sat, Sep 14, 2013 at 1:49 PM, Bruno Jouhier wrote: > > * inside wrap, call F.toString(), replace F() by F(a1, a2, ...), eval and > return the new function. > > I wondered why this would not be enough ... ```javascript function wrap(Function) { for(var i = 0, a = [

Re: static/class properties

2013-09-19 Thread Andrea Giammarchi
I cannot remember if that has been considered historically a Java or PHP error/ambiguity ... I'd rather not repeat that in ES6. A Class constant should have nothing to do with instances but instances can have properties that returns that class constant, if needed. We've got new syntax here so I s

Re: static/class properties

2013-09-19 Thread Andrea Giammarchi
Just some thought about the natiral following option: ```javascript class A {} const A.{ VALUE = 10; METHOD = function () {}; THOUGHTS = '?'; } ``` Cheers On Thu, Sep 19, 2013 at 11:08 AM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > the A.whatever is ex

Re: static/class properties

2013-09-19 Thread Andrea Giammarchi
the A.whatever is explicit to the class so it's the less ambiguous, IMO I see already confusing to understand if properties will be defined in the instance or in the class ... could not tell easily while I could, reading `A.VALUE = 10;` instead. Anyway, using that outside the class definition as:

Re: Question about reusing object used in Object.defineProperty

2013-09-23 Thread Andrea Giammarchi
If I might, and sinve I've been using this or that for a while, I rather find it convenient to use .value when you have other properties too instead of writing them all the time. That being said, for "few shots" ain't such big GC issue and actually some engine is faster in doing this {value:value}

Re: Comments on Sept Meeting Notes

2013-09-25 Thread Andrea Giammarchi
about that, not sure it's fully aligned with latest specs but it was behaving correctly and Brandon Benvie confirmed it a while ago: [Symbol simplified polyfill for ES5]( https://gist.github.com/WebReflection/5238782) Cheers On Tue, Sep 24, 2013 at 9:10 PM, Brendan Eich wrote: > Kevin Smith w

Re: ES Native Mode proposal

2013-09-25 Thread Andrea Giammarchi
it's like bringing realm all over in any part of any piece of code ... a road to hell for interoperability and/or security. I think you don't really want to: 1. include any jurassic JS library that has no reason to be used in current JS status 2. be sure that libraries that extend native cons

Re: ES Native Mode proposal

2013-09-25 Thread Andrea Giammarchi
in line ... On Wed, Sep 25, 2013 at 11:27 AM, Michaël Rouges wrote: > I personally don't use libraries, I create tools and advice every day > developers ... and it must be realistic, most don't even know what they > include. > which is why you don't want to promote a pattern that will be inevit

Re: ES Native Mode proposal

2013-09-25 Thread Andrea Giammarchi
much more than a possibly > native solution, mainly about performances, like my > Sandbox.js<https://github.com/Lcfvs/Sandbox.js> > . > > Michaël Rouges - https://github.com/Lcfvs - @Lcfvs > > > 2013/9/25 Andrea Giammarchi > >> in line ... >> >> >

Re: ES Native Mode proposal

2013-09-25 Thread Andrea Giammarchi
I think is not ... or at least is not real-world possibility. We have two scenarios: 1. you know what you include 2. you are the library included In first case you don't need anything because you know the code and you know no script will hurt so you can even do whatever you want with natives

Re: Safe, Closure-free, Serializable functions

2013-09-25 Thread Andrea Giammarchi
similar thread proposing 'use native' for the very similar problem safe closures would like to solve ... I wonder if it wouldn't be good enough to retrieve in a "read-only" fashion all original exposed function prototypes through a constant or read-only global property for the current realm ... so

Re: Safe, Closure-free, Serializable functions

2013-09-25 Thread Andrea Giammarchi
Sorry* *François, I didn't mean to say your goals were those but I see your problem as safe evaluation over a "must be safe" sort of local environment confined closure per closure which is actually similar to the 'use native' directive proposed in the other thread. My idea is that functions can

<    3   4   5   6   7   8   9   10   11   12   >