Re: about lightweight traits

2015-02-12 Thread Andrea Giammarchi
ldset, > but I restrict myself to methods found in Node (my base class) to be able > to use the trait in any situation. If I need functionality from another > trait, I mixin the other trait to make one trait. > > On Feb 12, 2015, at 12:07 PM, Andrea Giammarchi < > andrea.giammar

Re: about lightweight traits

2015-02-12 Thread Andrea Giammarchi
Luke, answering in order: 1. defining order, first come, first serve ... same as everything else on daily usage (events, Array of callbacks, etc) 2. You do not ever pass parameter to them, parameters are constructors matters, traits should be independent and unaware of constructors arguments othe

Re: about lightweight traits

2015-02-12 Thread Andrea Giammarchi
re fully independent. Do you need a lazy trait? Then you can expose an explicit method to set-it-up and invoke it whenever you want in your constructor. Does any of this make sense? It works already in some case of mine :-) On Thu, Feb 12, 2015 at 9:42 PM, Andrea Giammarchi < andrea.giam

Re: about lightweight traits

2015-02-13 Thread Andrea Giammarchi
ion into a class or another > trait is keeping track of what traits have been mixed in for a “hasTrait” > check. This isn't necessarily required as you can easily check for a method > you want to call, but it does allow you to make sure that the method > belongs to trait and c

Re: Performance of iterator .next() as specified

2015-02-15 Thread Andrea Giammarchi
+1 and I've raised same concerns 2 years ago [1] IIRC the outcome was that VM should be good enough to handle objects with very short lifecycle, I'm still convinced (behind tests) that generators are overkill for IoT devices (low clock and way lower RAM). Having always same object per iteration m

Re: Performance of iterator .next() as specified

2015-02-16 Thread Andrea Giammarchi
ot. But I don't know how realistic >> those optimizations are in practice. >> > > Not sure what you mean here. Unfortunately, result objects are still > mutable and extensible, so anything can happen. > > /Andreas > > > On 15 February 2015 at 02:36, Andrea Giam

Re: Performance of iterator .next() as specified

2015-02-16 Thread Andrea Giammarchi
then frozen `{done: false}` without even the `value` property ... Would this work or speed-up anything at all? On Mon, Feb 16, 2015 at 2:32 PM, Andreas Rossberg wrote: > On 16 February 2015 at 15:21, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> > Share

Re: Performance of iterator .next() as specified

2015-02-16 Thread Andrea Giammarchi
e all needed On Mon, Feb 16, 2015 at 2:38 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > then frozen `{done: false}` without even the `value` property ... Would > this work or speed-up anything at all? > > On Mon, Feb 16, 2015 at 2:32 PM, Andreas Rossberg >

Re: Performance of iterator .next() as specified

2015-02-16 Thread Andrea Giammarchi
; author who is concerned about the difficulty of implementing such an > optimization. > > Having a shared object means much more escape tracking than if the object > was not shared. > > Just my 2 cents. > > On Mon, Feb 16, 2015 at 8:32 AM, Andreas Rossberg > wrote:

Re: Performance of iterator .next() as specified

2015-02-16 Thread Andrea Giammarchi
igh" Best Regards On Mon, Feb 16, 2015 at 3:45 PM, Andreas Rossberg wrote: > On 16 February 2015 at 15:41, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> Common pattern is to poll.next() a yield until its `done` property is >> `true` so that a value c

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
> not evidence of real-world usage that would break popular websites the Web is (still and thankfully) not about popular websites only. Using the `Array.prototype` instead of creating instances in the wild has been seen for long time, same way you don't do `{}.toString.call` but `Object.prototype

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
Andrea, you seem to not understand what change is being discussed here. > Nobody is talking about removing or changing the behavior of > Array.prototype.concat. Please re-read. > ------ > From: Andrea Giammarchi > Sent: ‎2015-‎02-‎19 11:57 > To: Domenic D

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
ve missed many, like this one, for example) or can we just stick with the "ES6 is backward compat" umbrella? Best Regards On Thu, Feb 19, 2015 at 5:21 PM, Mark S. Miller wrote: > > > On Thu, Feb 19, 2015 at 8:57 AM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wro

Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Andrea Giammarchi
Just as workaround, if you really need that much to freeze the `Object.prototype`, you could: ```js Object .getOwnPropertyNames(Object.prototype) .filter((name) => !/^constructor|toString|valueIOf$/.test(name)) .forEach((name) => Object.defineProperty( Object.prototype, name, {va

Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Andrea Giammarchi
this, and the fact descriptors suffer inheritance which for 3 boolean properties or a method are absolutely not helpful and make the env doomed by `Object.prototype.writable = true` shenanigans. Yes, I'd personally +1 all these fixes that made these ES5 features not the easiest one to play with O

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
Annex E ... I've never reached that part ... Thanks! On Thu, Feb 19, 2015 at 5:42 PM, Domenic Denicola wrote: > From: Andrea Giammarchi [mailto:andrea.giammar...@gmail.com] > > > Can we have either a list of these changes (I'm sure I've missed many, > like this

Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Andrea Giammarchi
`, but good to know, I could have fallen hard there. Cheers On Thu, Feb 19, 2015 at 6:06 PM, Mark S. Miller wrote: > > > On Thu, Feb 19, 2015 at 9:54 AM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> Just as workaround, if you really n

Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Andrea Giammarchi
ion. If you seal-freeze-scotch-tape > Object.prototype up, no-one's going to add `get`s, `set`s and `writable`s > to it. Taking inheritance into account in defineProperty won’t then be a > problem. > > A. > > On Feb 19, 2015, at 19:58, Andrea Giammarchi > wrote: > > thi

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
if we'd like to have Array.empty, Function.empty, String.empty and friends, what's wrong with having these as we always had already: as prototypes? I see just moving and duplicating gotchas, instead of keeping in a well known behavior. This exotic "problem" ... I never really understood it, I bli

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
yep, not only you can, but also consider if that was frozen, half of ES5 wouldn't have existed. You want to exted it? Thanks to ES5 just go for it! You want to be obtrusive or that secure? Freeze it. Does this affect the ability to use Array.prototype as empty array? Not at all, it does not change

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Andrea Giammarchi
P.S. yes, the semantic already frozen purpose of an empty property though, I agree that'd be cool On Thu, Feb 19, 2015 at 8:21 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > yep, not only you can, but also consider if that was frozen, half of ES5 > wouldn't

Re: Class syntax enhancements

2015-02-20 Thread Andrea Giammarchi
FWIW when I mixin objects (that are considered traits) into classes [1], methods and accessors are assigned as other classes methods/accessors would (non enumerable) It feels right and work as expected, so your example would simply be ```js class Foo { with: [{ bar, /* Existing method */

Re: Class syntax enhancements

2015-02-20 Thread Andrea Giammarchi
They want magic most of time anyway :-) I wasn't saying enumerable and others are keywords aren't a bad idea, I'm say when you import to class you would probably expect non enumerable anyway, and too verbose class declarations aren't that good-looking. Hope you got my point. Regards On Fri, Feb

Re: *.empty Idea

2015-02-23 Thread Andrea Giammarchi
quick one to whoever will write the proposal: please bear in mind the empty function **must** have a frozen prototype too Regards On Sun, Feb 22, 2015 at 11:18 PM, Jordan Harband wrote: > I'd love to bring a proposal to the committee for this since it seems like > there's interest. > > I suspec

Re: Function "name" property

2015-02-26 Thread Andrea Giammarchi
I miss you `arguments.callee`, specially in this "fat arrows era" where most of the time developers don't even care about removing listeners. Apologies for the laud thought and Best Regards On Thu, Feb 26, 2015 at 4:32 PM, Allen Wirfs-Brock wrote: > > On Feb 26, 2015, at 4:10 AM, Leon Arnott wr

Re: Function "name" property

2015-02-26 Thread Andrea Giammarchi
gt; > What was the main reason why caller/calee were removed? > > Cheers. > > > On Thu, Feb 26, 2015 at 2:09 PM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> I miss you `arguments.callee`, specially in this "fat arrows era" where >>

Re: Function "name" property

2015-02-26 Thread Andrea Giammarchi
ES7MetaProps.md > > > > > On Feb 26, 2015, at 12:19 PM, Mark S. Miller wrote: > > On Thu, Feb 26, 2015 at 10:52 AM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> `callee` could be spec'd similar to `super` and transpiled or resolved >

Re: Proposal: Additional Meta Properties for ES7

2015-02-26 Thread Andrea Giammarchi
I personally wouldn't mind `self` but it has been historically used as context or global reference, while callee ... you don't probably need to explain what's that about. On the other hand, from `arguments` object, `callee`was more semantic but it feels not th ebest choice from `function` indeed.

Re: Proposal: Additional Meta Properties for ES7

2015-02-26 Thread Andrea Giammarchi
agreed ... between `self` and `callee` probably `self` is better. Anyone with a different/new idea? On Thu, Feb 26, 2015 at 11:50 PM, Tab Atkins Jr. wrote: > On Thu, Feb 26, 2015 at 3:27 PM, Claude Pache > wrote: > > Alternative name for `function.callee`: I find that `function.self` > sounds

Re: Proposal: Additional Meta Properties for ES7

2015-02-26 Thread Andrea Giammarchi
had same thought ... that wouldn't need much explanation neither. +1 here On Thu, Feb 26, 2015 at 11:59 PM, Domenic Denicola wrote: > function.current? > -- > From: Andrea Giammarchi > Sent: ‎2015-‎02-‎26 18:56 > To: Tab Atkins Jr. > Cc: es

Re: Proposal: Additional Meta Properties for ES7

2015-02-26 Thread Andrea Giammarchi
another basic example with listeners ``` window.addEventListener('load', (e) => { // how am I going to remove this listener? console.log('everything loaded'); }); ``` Specially on UI world, many libraries do attach tons of things at runtime, within methods, and have no way to remove them if n

Re: Cancelable promises

2015-02-26 Thread Andrea Giammarchi
AFAIK bluebird did: https://github.com/petkaantonov/bluebird/blob/master/API.md#cancelerror-reason---promise But I agree once you've made Promises more complex than events ( xhr in this case ) nobody wins :-/ Although, specially for fetch or anything network related, there **must** be a way to bl

Re: Object.assign and inherited properties

2015-02-27 Thread Andrea Giammarchi
You are talking about "flatting" all properties, which is an undesired overhead. ```js var b = Object.create( Object.getPrototypeOf(a) ); Object.assign(b, a); ``` But what's bugging me every time more, is that somebody had a very bad idea to spread `Object.assign` as something good for inher

Re: Object.assign and inherited properties

2015-02-27 Thread Andrea Giammarchi
them out, if not, the > dot-operator takes it into account. Surely no-one’s expecting everyone to > prefix _every_ obj.name use with hasOwn: `*obj.hasOwnProperty(“name”) && > obj.name <http://obj.name>`*. Why do it in Object.assigns then is beyond > me. Inconsistent and unc

Re: Proposal: Additional Meta Properties for ES7

2015-02-27 Thread Andrea Giammarchi
and yet you haven't removed any anonymous arrow listener. Assign first? Mostly nobody will do that, it's just less natural then `obj.on(something, ()=>happening)` On Fri, Feb 27, 2015 at 3:59 PM, Claus Reinke wrote: > Can you show an example of how callee is used with a fat arrow function? >>> >

Re: Object.assign and inherited properties

2015-02-27 Thread Andrea Giammarchi
dictionaries and for/in when all this does not matter. I really don't see, with all possibilities you have to write the way you want, and a function I wrote for you that does what you need, why bothering `Object.assign` Best Regards > > A. > > On Feb 27, 2015, at 15:40, Andrea Giamm

Re: Function "name" property

2015-02-27 Thread Andrea Giammarchi
Mark many framewors/libraries/younameit attach listeners at construction time, there is where everyone feels like it's cool and fast and better, and shorter to use arrow functions, then they have to mix between removable listeners and not. I personally pass objects as listeners, providing an `hand

Re: Object.assign and inherited properties

2015-02-27 Thread Andrea Giammarchi
n(john) // => John is from Estonia. > logTraveler(john) // => John is from undefined. > ``` > > While a little contrived, like I said, Object.assign and its equivalents > from libraries are already used to set defaults. > Just in case: please don’t propose replacing every Ob

Re: Proposal: Additional Meta Properties for ES7

2015-02-27 Thread Andrea Giammarchi
nope, you are limiting your object to have only one listener per event, I think that's not quite how reality is. You gonna lose that listeners next time somebody use same name with the same object. In (?:io|node)js you have EventEmitter that exposes .on, on web even jQuery needs that reference in

Re: Proposal: Additional Meta Properties for ES7

2015-02-27 Thread Andrea Giammarchi
I think the fact you had to write two solutions where one attach to the object the listener and another one needs a double arrow (rainbow) already shows we have a hole in the language once covered by arguments.callee. The more you write examples, the more you convince me we are missing callee ;-)

Re: Object.assign and inherited properties

2015-02-27 Thread Andrea Giammarchi
his prototypal language in a classical way. > No, I do like prototypal inheritance and I love the fact it's still the root of JS inheritance. What is my personal position here is that `Object.assign` is the wrong method/tool/function to do anything prototypal or classical inheritanc

Re: Object.assign and inherited properties

2015-02-27 Thread Andrea Giammarchi
e or assign them around. >>>>> >>>> > Inheritance? Inheritance is an implementation detail. A function receiving >>>>> an object must not care about its inheritance tree as long as it fulfills >>>>> the required interface. That’s what the L

Re: Object.assign and inherited properties

2015-02-27 Thread Andrea Giammarchi
eeded]. Seriously. Please share your counter-arguments and if I > can, I’ll counter them or if not, agree. Relating to Object.assign in this > thread, of course. > > A. > > On Feb 28, 2015, at 00:40, Andrea Giammarchi > wrote: > > I think your issue is not real, since

Re: Function "name" property

2015-02-27 Thread Andrea Giammarchi
but how would you drop that listener, if that's even a concern of yours, beside the usage of `function`? Does "I agree with Mark" means already two think arrows function should never be self-reference-able? Just a genuine question, thanks On Sat, Feb 28, 2015 at 12:37 AM, Brendan Eich wrote: >

Re: Function "name" property

2015-02-28 Thread Andrea Giammarchi
FWIW `in` looks good to me, it's self explanatory , but `in.self` or `in.current` don't look god anymore. Would it be utterly insane to have `in.function` and `function.function` to reference to the function? If `in.function` works as `function.function` outside arrows, same as `in.count` reference

Re: Cancellation architectural observations

2015-03-02 Thread Andrea Giammarchi
> the rare cancellation case abort is not a rare case, and an ignore that does not abort makes no sense whatsoever. If I am paying data and I've requested 10 tiles on a mobile maps based sites and I search/go/locate somewhere else on the other edge on the world it makes no sense to wait for the i

Re: iterator next method returning new object

2015-03-02 Thread Andrea Giammarchi
about preventing jerkiness around the object passed around ... with some logic similar to this one: ```js function proxiedOwnValues(obj) { return Object.freeze(Object.keys(obj).reduce(function (o, k) { return Object.defineProperty(o, k, { get: function () { return obj[k];

Re: Cancellation architectural observations

2015-03-02 Thread Andrea Giammarchi
So this is my simplified view of the matter ... it already works, and it aborts eventually with the ability to ignore the onabort callback. The config object can have `onabort` that activates the "abort-ability", the `onprogress` so that eventually this promise inside a generator can still update

Re: Accepting an array as the first parameter to String.prototype.includes

2015-03-10 Thread Andrea Giammarchi
I'm still having hard time understanding what's the difference between contains and the good old indexOf beside the RegExp check ... but I agree having multiple explicit searches instead of multiple implicit searches won't make such big difference. Good news is, you probably will still use RegExp a

Re: Accepting an array as the first parameter to String.prototype.includes

2015-03-10 Thread Andrea Giammarchi
r all other examples. but just the `!=-1` or `>-1` as reason to prefer contains? ... dunno, I think I have 99 problems in JS related development, `>-1` ain't one :-/ On Tue, Mar 10, 2015 at 8:42 PM, Garrett Smith wrote: > On 3/10/15, Andrea Giammarchi wrote: > > I'm sti

Re: Accepting an array as the first parameter to String.prototype.includes

2015-03-10 Thread Andrea Giammarchi
also, just for people not afraid of the tilde `["Maria", "Mariana"].some(e=>~a.indexOf(e));` yeah, you can use it ^_^ On Tue, Mar 10, 2015 at 9:34 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > contains better than indexOf ? I'd agree on

Re: Accepting an array as the first parameter to String.prototype.includes

2015-03-10 Thread Andrea Giammarchi
`str` as context per each iteration. Is that confusing? 'cause that's how some/every/forEach/map/filter work On Tue, Mar 10, 2015 at 10:18 PM, Garrett Smith wrote: > On 3/10/15, Andrea Giammarchi wrote: > > contains better than indexOf ? I'd agree only if contains was

Re: Converting strings to template strings

2015-03-22 Thread Andrea Giammarchi
There's no such functionality indeed but you might want to have a look at this gist: https://gist.github.com/WebReflection/8f227532143e63649804 It gives you the ability to write `'test1 ${1 + 2} test2 ${3 + 4}' .template();` and read `test1 3 test2 7` or to pass an object similar to .Net String.fo

Re: Supporting feature tests directly

2015-03-22 Thread Andrea Giammarchi
+1 to Kyle proposal, using eval or Function is not even an option in CSP constrained environments ( unless the relative code is provided as SHA256, then we need to agree on how such code should look like and share it as polyfill ) I'd also suggest `Reflect.isValidSyntax` as alternative to `Reflect

Re: Converting strings to template strings

2015-03-22 Thread Andrea Giammarchi
un, Mar 22, 2015 at 11:28 AM, Mark S. Miller wrote: > > > On Sun, Mar 22, 2015 at 6:46 AM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> There's no such functionality indeed but you might want to have a look at >> this gist: https://gist.github

Re: Converting strings to template strings

2015-03-22 Thread Andrea Giammarchi
27;t > contain a string that, for example, closes the function with an unbalanced > "}", then has an evil expression which evaluates, followed by an > unbalanced "{" so the whole thing still parses? > > On Sun, Mar 22, 2015 at 7:38 AM, Andrea Giammarchi < > andr

Re: Converting strings to template strings

2015-03-23 Thread Andrea Giammarchi
access those properties without using `with` and avoiding a whole parser for the string. Thanks and Best Regards On Mon, Mar 23, 2015 at 6:55 AM, Mark S. Miller wrote: > > > On Sun, Mar 22, 2015 at 10:27 AM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >

Re: Converting strings to template strings

2015-03-23 Thread Andrea Giammarchi
Even a function wouldn't scale that well for i18n purpose, 'cause you should write either a function per language or each language switch statement per function. I see current ES6 string templates good for debug purpose only, and not much else ... maybe English centric developers tools so few, def

Re: Iterating default function arguments

2015-03-25 Thread Andrea Giammarchi
I think the main concern was: > Currently I can't see a way of getting default parameters as an iterable object. and indeed `arguments` is not the magic variable you are looking for. However, you are inside your own defined function so either you don't specify defaults, or you iterate over `[a,

Re: Iterating default function arguments

2015-03-25 Thread Andrea Giammarchi
Sounds good to me and makes perfect sense. Robin? On Wed, Mar 25, 2015 at 5:23 PM, Brendan Eich wrote: > Andrea Giammarchi wrote: > >> I think the answer is still a static `[a, b]` as list of arguments to >> apply, but I can see some lack of "reflection" capability .

Re: Supporting feature tests directly

2015-03-25 Thread Andrea Giammarchi
. Best Regards On Wed, Mar 25, 2015 at 7:44 PM, Tab Atkins Jr. wrote: > On Sun, Mar 22, 2015 at 3:59 AM, Andrea Giammarchi > wrote: > > +1 to Kyle proposal, using eval or Function is not even an option in CSP > > constrained environments ( unless the relative code is pr

Re: Cancellation architectural observations

2015-03-27 Thread Andrea Giammarchi
following up from this https://github.com/whatwg/fetch/issues/27#issuecomment-86987752 , and most likely late to the party. How about cancel-ability done this way ? ```js var p = new Promise(function (res, rej, cancel) { // resolved in 1 second via random value var t = setTimeout(res, 1000,

Re: Cancellation architectural observations

2015-03-29 Thread Andrea Giammarchi
was mainly to provide a playground and I don't see any real violation of the Promises principles. The presence of `cancel` and its ability is a contract between the Promise creator/provider and the external world. Best Regards On Fri, Mar 27, 2015 at 5:43 PM, Andrea Giammarchi < andrea.giammar

Re: Cancellation architectural observations

2015-03-29 Thread Andrea Giammarchi
s soon as the promise in cancelableGet settled. > > > This also allows for non-overlapping names for events (Symbol should be > permitted), where there may be multiple cancelable things in the chain. > > It also allows additional metadata, or different event names when 'cancel&#

Re: Unicode normalization problem

2015-04-01 Thread Andrea Giammarchi
I think the concern on how people seeing what they see can be understood from JS is more than valid ... ```js var foo = '𝐀'; var bar = 'Й'; foo.length; // 2 Array.from(foo).length // 1 bar.length; // 2 Array.from(foo).length // 2 ``` Why is that and how to solve? On Wed, Apr 1, 2015 at 10:32

Re: Unicode normalization problem

2015-04-01 Thread Andrea Giammarchi
```js foo.length; // 2 Array.from(foo).length // 1 bar.length; // 2 Array.from(bar).length // 2 ``` I know already everything you wrote ... now, how to explain to JS users out there and how to solve? On Thu, Apr 2, 2015 at 1:04 AM, Boris Zbarsky wrote: > On 4/1/15 6:56 PM, Andrea Giammar

Re: Unicode normalization problem

2015-04-01 Thread Andrea Giammarchi
and now I also gonna hope that `Array.from(foo).length // 2` wasn't by accident, instead of `bar` ... On Thu, Apr 2, 2015 at 1:07 AM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > ```js > foo.length; // 2 > Array.from(foo).length // 1 > > bar.length; //

Re: Unicode normalization problem

2015-04-01 Thread Andrea Giammarchi
p of two, and the [image: 💩] character (it's a fun example to use) > is an example of two characters combining to make one "code point". It's > not a quick or trivial thing to explain but people do seem to grasp it > eventually. > > On Wed, Apr 1, 2015 at 4:09 P

Re: Array.prototype.find - Proposal for (breaking) change of API

2015-04-07 Thread Andrea Giammarchi
not sure if off topic but * you need a with statement to use lodash like that * ... the following ... ``` let found = first(filter( map(files, _ => path.resolve(base, _)), fs.existsSync )); ``` is a very wasteful pattern ... have you ever heard of `some` ? ``` let found; some(files, _ =

Re: Array.prototype.find - Proposal for (breaking) change of API

2015-04-07 Thread Andrea Giammarchi
on 3 map and filter (or Python 2 itertools equivalents). > > > On Tuesday, April 7, 2015, Andrea Giammarchi > wrote: > >> not sure if off topic but >> >> * you need a with statement to use lodash like that >> * ... the following ... >> >> ```

Re: Array.prototype.find - Proposal for (breaking) change of API

2015-04-07 Thread Andrea Giammarchi
actually never-mind, I got hooked by the "Libs like lodash and lazy.js provide the bits you need" and thought you were using those functions as if magically wrapped in a `with` statement ... oh well, sorry for the noise: keep "iterating" On Wed, Apr 8, 2015 at 12:28 A

Re: Syntax sugar for partial application

2015-04-09 Thread Andrea Giammarchi
FWIW: agreed with others, it looks a pretty pointless sugar. It doesn't seem to bring anything new or "that needed" to the language. -1 here On Thu, Apr 9, 2015 at 2:04 PM, liorean wrote: > Do we really need it? > Your «foo(1, ?, 2);» is equivalent to «a=>foo(1,a,2)». > Your «foo(?, 1, ???);» i

Re: Final ES6 Draft

2015-04-17 Thread Andrea Giammarchi
"The final ES6 ECMAScript 2014 .." aka: *The 2015 ECMAScript Language Specification* Did I say already putting a year in the name was confusing? :P Congratulations Allen and thanks to everyone contributing making this happens. Best Regards P.S. little typo in that page ... "This is the final dr

Putting `global` reference in specs

2015-04-17 Thread Andrea Giammarchi
We have `window` in DOM land, `self` in Workers, and `global` in most common server side JS engines ... plus we have this in ES6 specification: > In addition to the properties defined in this specification the *global* object may have additional host defined properties. This may include a property

Re: Putting `global` reference in specs

2015-04-17 Thread Andrea Giammarchi
lobal and Worker I don't actually care) and add a `global` that nobody needs explanation to understand what it is in JavaScript On Fri, Apr 17, 2015 at 4:02 PM, Boris Zbarsky wrote: > On 4/17/15 10:55 AM, Andrea Giammarchi wrote: > >> We have `window` in DOM land, `self` in

Re: Putting `global` reference in specs

2015-04-17 Thread Andrea Giammarchi
there's actually no way, officially, to reference what ES2015 call *the global object*, just pointless fragmentation between engines. On Fri, Apr 17, 2015 at 4:19 PM, Anne van Kesteren wrote: > On Fri, Apr 17, 2015 at 5:12 PM, Andrea Giammarchi > wrote: > > So I'd

Re: Putting `global` reference in specs

2015-04-17 Thread Andrea Giammarchi
it's a no-go under CSP so it's as bad as `Function('return this')()` On Fri, Apr 17, 2015 at 4:29 PM, Boris Zbarsky wrote: > On 4/17/15 11:27 AM, Mark S. Miller wrote: > >> (1,eval)('"use strict"; this') >> > > This has the drawback of making eyes bleed, but the benefit of working > reliably (un

Re: Putting `global` reference in specs

2015-04-17 Thread Andrea Giammarchi
every developer benefit ( 8.5 + 14.1 millions of results in Github for `typeof global` apparently got unnoticed ) On Fri, Apr 17, 2015 at 4:33 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > it's a no-go under CSP so it's as bad as `Function('return this&#

Re: Putting `global` reference in specs

2015-04-17 Thread Andrea Giammarchi
PM, Mark S. Miller wrote: > > > On Fri, Apr 17, 2015 at 8:39 AM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > >> also `eval` can be in-scope redefined as much as global, window, or self, >> so no, that's actually not a solution. >> &g

Re: Putting `global` reference in specs

2015-04-17 Thread Andrea Giammarchi
f global` is not undefined is ... well, the most basic and striking fragmentation case we have at the root of the language ^_^ On Fri, Apr 17, 2015 at 5:13 PM, Mark S. Miller wrote: > > > On Fri, Apr 17, 2015 at 9:05 AM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote:

Re: Putting `global` reference in specs

2015-04-17 Thread Andrea Giammarchi
ironment" that are more abstract than real. > > -Original Message- > From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of > Anne van Kesteren > Sent: Friday, April 17, 2015 11:19 > To: Andrea Giammarchi > Cc: es-discuss@mozilla.org > Subject: Re: Pu

Re: Putting `global` reference in specs

2015-04-17 Thread Andrea Giammarchi
JS in 1995, I made > multiple names for the global, in part because event handlers (which > prefigured nested functions in general, and added with-like DOM object > scoping -- a regret); but also in part because was a > thing in Netscape 2. > > /be > > > Boris Zbarsky

Re: Putting `global` reference in specs

2015-04-17 Thread Andrea Giammarchi
, 2015 at 10:38 PM, Brendan Eich wrote: > The principle extends just fine to workers, and has. > > /be > > > Andrea Giammarchi wrote: > >> And that's indeed the only place on Web world where `self` makes sense: >> > __

Re: Putting `global` reference in specs

2015-04-18 Thread Andrea Giammarchi
ing lately has read the whole thread carefully > :-|. > > /be > > Andrea Giammarchi wrote: > >> Sure workers too, but it doesn't in server side and it doesn't mean >> anything meaningful for all developers coming from other languages. `self` >> is a misl

Re: Subclassing ES6 objects with ES5 syntax.

2015-04-24 Thread Andrea Giammarchi
Not exactly ... if it's an Array, as example, the moment you slice/map/splice/concat, etc will return an instanceof Array, not an instance of whatever you have sublcassed. Regards On Fri, Apr 24, 2015 at 10:24 AM, Alex Kocharin wrote: > > I believe you can subclass anything using code like this

Re: Subclassing ES6 objects with ES5 syntax.

2015-04-24 Thread Andrea Giammarchi
totype[method].apply(this, args) > Object.setPrototypeOf(result, MyArray.prototype) > return result > } > }) > > console.log(MyArray(1).slice(1) instanceof MyArray) > // true > ``` > > > 24.04.2015, 14:13, "Andrea Giammarchi" : > > Not exactly ... if

Re: Merge map values

2015-04-28 Thread Andrea Giammarchi
Not sure why everyone went for the `Map` version when in JS every object is basically the equivalent of a `Map` already :-) ```js let m = Array.from("mainn").reduce((m,k) => ((m[k] = 1 + (m[k] | 0)), m), {}); ``` looks a win to me, if you need to check or drop chars from the string I would probab

Re: Merge map values

2015-04-28 Thread Andrea Giammarchi
asily adapted to Maps, I like the way you use > `reduce()`. The `|` should be a `||`. > > On 28 Apr 2015, at 14:31 , Andrea Giammarchi > wrote: > > Not sure why everyone went for the `Map` version when in JS every object > is basically the equivalent of a `Map` already :-) > &g

Re: Merge map values

2015-04-28 Thread Andrea Giammarchi
Moreover `undefined|0` is exactly 0. The `|0` is used in asm.js because it explicitly declares the intent. So again, no error in there ;-) Regards On Tue, Apr 28, 2015 at 1:58 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > Now you read again the "exercise"

Re: Merge map values

2015-04-28 Thread Andrea Giammarchi
f it was a owrd counter, I'd use same logic with new Map passed instead of {} and the correct .set/.get invoke Best Regards On Tue, Apr 28, 2015 at 2:02 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > Moreover `undefined|0` is exactly 0. The `|0` is used in asm.js

Re: Additional Math functions

2015-04-30 Thread Andrea Giammarchi
I've actually found this limit in the past [1] mostly for string operations and I remember it was already discussed in here. 2048 was a safe bet for all browsers I could test those days, but it'b be very nice if any generic function, accordingly with the environment capabilities, could expose some

Re: Can't do push in forEach

2015-05-14 Thread Andrea Giammarchi
`$1 => a.push($1)` fat arrow function shines mostly in these cases, not sure there's a need for anything else. `($1, $2, $3) => a.push($2, $3)` Regards On Thu, May 14, 2015 at 5:26 PM, Emanuel Allen wrote: > That would be great to have an only method on Function.prototype.only > > It can take

Re: Reflect.type

2015-05-14 Thread Andrea Giammarchi
FWIW, I think whatever contains "type" in modern JS should consider `int32`, `float64`, and all TypedArrays plus it would be awesome to have a way to define own types. In any case, if your idea will be implemented, I think it should have named Symbols for debugging sake. ```js Symbol('undefined')

Re: Can't do push in forEach

2015-05-14 Thread Andrea Giammarchi
arr.forEach(arr.push.only(1)); > > Even know only will return another function base on the parameter to you > pass to it. > > Still, I think it would be a great addition to the Function.prototype > object. > > JS4L > > On May 14, 2015, at 1:42 PM, Andrea Giammarchi

Re: let function

2015-05-14 Thread Andrea Giammarchi
I guess 'cause that cannot be scoped, let's say in a for loop ... but yeah, I think that's not the most needed thing in the language right now, yet another shortcut with double reserved words one after the other Regards On Thu, May 14, 2015 at 7:45 PM, Kevin Smith wrote: > Why not use a functio

Re: Can't do push in forEach

2015-05-14 Thread Andrea Giammarchi
o it. >> > Sent from my iPhone > > On May 14, 2015, at 2:50 PM, Andrea Giammarchi < > andrea.giammar...@gmail.com> wrote: > > > So this style I favorite since I want to avoid creating another > function: > > this is like believing that `fn.bind()` won'

Re: let function

2015-05-14 Thread Andrea Giammarchi
not, in fact, in a backward compatible way, unless transpiled. On Thu, May 14, 2015 at 8:00 PM, Domenic Denicola wrote: > They can, in fact, be scoped in a for loop. > > > > *From:* es-discuss [mailto:es-discuss-boun...@mozilla.org] *On Behalf Of > *Andrea > Giammarchi &g

Re: let function

2015-05-14 Thread Andrea Giammarchi
like I've replied to Domenic, you need to transpile if you want function declaration block-scoped backward compatible and all other ES6 goodies. babeljs would be my pick: https://babeljs.io Best Regards On Thu, May 14, 2015 at 8:40 PM, Alexander Jones wrote: > Ah, thanks for explaining! What a

Re: function.next meta-property proposal

2015-05-14 Thread Andrea Giammarchi
Alexander ES6 "is out" as it is, here the proposal is to make reachable that argument because indeed, since about ever, in JS you can ignore arguments, but you can also always reach them through the argument object. When it comes to generators, arguments object would be a misleading place to give

Re: function.next meta-property proposal

2015-05-14 Thread Andrea Giammarchi
actually, that won't work ... so yeah, that pattern is somehow compromise, arguments is used to indeed initialize the generator, no way to put first value in ... oh well On Thu, May 14, 2015 at 11:44 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > Alexander ES6 &qu

  1   2   3   4   5   6   7   8   9   10   >