I just asked Raul's weird syntax question in SO and tried to answer it myself. Going through the spec, I have to admit that he has a point and things could be clearer. I think the JS spec being good is a big factor not only for implementers but for developers too and it could be better :)
However, admittedly I'm not a great writer myself and I don't know how the spec itself could be clearer in this case, and it was good *enough *for me as someone who has already read the spec to walk through. It would be great if that would be the case for new developers too. http://stackoverflow.com/questions/18947892/creating-range-in-js-strange-syntax/ The exact same thing goes to modulo in the spec Benjamin ---------- Forwarded message ---------- > From: Brendan Eich <[email protected]> > To: raul mihaila <[email protected]> > Cc: [email protected] > Date: Sat, 21 Sep 2013 13:21:24 -0700 > Subject: Re: modulo > Since no one else replied, I will take a stab. > >> raul mihaila <mailto:[email protected]**> >> September 17, 2013 2:46 PM >> If I understand correctly, q = floor(x / y), in x - k = q x y, where k = >> x modulo y. If this is correct I think that such a note would be nice to >> have for non-mathematicians. :) >> > > It follows from 5.2, Algorithm Conventions, specifically: > > The mathematical function floor(x) yields the largest integer (closest to > positive infinity) that is not larger than x. > > NOTE floor(x) = x-(x modulo 1). > > /be > >> >> Raul M >> ______________________________**_________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss> >> > > > > ---------- Forwarded message ---------- > From: Jason Orendorff <[email protected]> > To: Brandon Benvie <[email protected]> > Cc: es-discuss <[email protected]> > Date: Sat, 21 Sep 2013 17:50:29 -0500 > Subject: Re: [[Invoke]] and implicit method calls > On Fri, Sep 20, 2013 at 6:27 PM, Brandon Benvie <[email protected]> > wrote: > > Actually, taking the precedent of removing "getPropertyDescriptor", it's > > "has" that would be removed. > > I think the logic of the current design is: primitives we keep; > high-level operations that correspond to everyday syntax built into > the language from of old (get/set/has/enumerate), we keep. But > .hasOwn, like .getPropertyDescriptor, is neither. > > -j > > > > ---------- Forwarded message ---------- > From: raul mihaila <[email protected]> > To: Brendan Eich <[email protected]> > Cc: [email protected] > Date: Sun, 22 Sep 2013 13:29:58 +0300 > Subject: Re: modulo > I saw that. I'm sure the spec is clear enough for implementers. Somebody > mentioned that book authors should explain the spec to the developers. But > the books aren't enough. For example, I didn't see something like this in > any JS book that I've read. Array.apply(null, { length: 5 > }).map(Number.call, Number); > https://twitter.com/cowboy/status/288702647479984128 > When an empty array or an 'empty array-like object' (but with a valid > length property that is greater than 0) is used in the apply method, you'd > think that no arguments are actually passed, because it's not intuitive to > think otherwise. Only when you read the spec you see that something like > this is possible. (I'm not saying that there's absolutely no book that > explains this, but I can't read them all). I don't know what can be done... > Regarding the modulo/floor section, I would prefer something like this > instead: > > The mathematical function floor(*x*) produces the largest integer > (closest to positive infinity) that is not larger than x. > The notation "*x* modulo *y*" (y must be finite and nonzero) computes a > value k of the same sign as y (or zero) such that abs(*k*) < abs(*y*) and > *x*-*k* = *q* × y, where q = floor(x / y). > NOTE floor(*x*) = *x*-(*x* modulo 1). > > Raul M > > > On Sat, Sep 21, 2013 at 11:21 PM, Brendan Eich <[email protected]>wrote: > >> Since no one else replied, I will take a stab. >> >>> raul mihaila <mailto:[email protected]**> >>> September 17, 2013 2:46 PM >>> >>> If I understand correctly, q = floor(x / y), in x - k = q x y, where k = >>> x modulo y. If this is correct I think that such a note would be nice to >>> have for non-mathematicians. :) >>> >> >> It follows from 5.2, Algorithm Conventions, specifically: >> >> The mathematical function floor(x) yields the largest integer (closest to >> positive infinity) that is not larger than x. >> >> NOTE floor(x) = x-(x modulo 1). >> >> /be >> >>> >>> Raul M >>> ______________________________**_________________ >>> es-discuss mailing list >>> [email protected] >>> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss> >>> >> > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

