It's a bit unclear to me how arrow functions react to semicolons, for
example:
var a = (c) = {
var b = 2;
b * c;
}
a(4);
To me, it seems like this should return undefined. After all, the last
statement in the function is empty. To actually return b * c, you should
drop the semicolon:
var a
Le 29/11/2012 06:20, Brandon Benvie a écrit :
The answer though in that case is easy enough though, make sure the
prototype descriptor is created with Object.create(null). This
wouldn't solve compatibility issues with in-the-wild code but it
solves the issue for most people who care enough to
Le 29/11/2012 09:41, Jussi Kalliokoski a écrit :
It's a bit unclear to me how arrow functions react to semicolons, for
example:
var a = (c) = {
var b = 2;
b * c;
}
a(4);
To me, it seems like this should return undefined. After all, the last
statement in the function is empty. To
Jussi Kalliokoski wrote:
It's a bit unclear to me how arrow functions react to semicolons, for
example:
var a = (c) = {
var b = 2;
b * c;
}
a(4);
To me, it seems like this should return undefined. After all, the last
statement in the function is empty.
Not by the grammar.
You would
On Thu, Nov 29, 2012 at 10:32 AM, Brendan Eich bren...@mozilla.com wrote:
You would need a second ; after b * c; to spell the empty statement.
Interesting fact actually, it would mean the empty statement is no
longer a NOOP. It can actually alter a program. I can't think of a
situation where
Object.defineProperty(obj,key, Object.create(defaultDataProperty, {value:
123});
Er, shouldn't that be:
Object.defineProperty(obj,key,Object.create(null, {value: {value: 123}}));
Seems pretty excessive. It's probably too late to make defineProperty only look
at own properties, but how about
Le 29/11/2012 16:47, Nathan Wall a écrit :
In addition, it'd be nice if there was an easier way to create an
object with no [[Prototype]]... some sort of addition to object
literal notation?
I think ES6 will have such a notation with the __proto__ de facto
standardization:
var o = {
On Nov 29, 2012, at 7:47 AM, Nathan Wall wrote:
Object.defineProperty(obj,key, Object.create(defaultDataProperty, {value:
123});
Er, shouldn't that be:
Object.defineProperty(obj,key,Object.create(null, {value: {value: 123}}));
oops, yes create requires an addition object layer
Le 29/11/2012 17:02, Allen Wirfs-Brock a écrit :
On Nov 29, 2012, at 7:47 AM, Nathan Wall wrote:
Seems pretty excessive. It's probably too late to make defineProperty
only look at own properties, but how about making it ignore
properties inherited from Object.prototype?
Fairly complex to
The intention was definitely to test step 2 which this particular test
doesn't hit. Looks like other 'step 2' tests do though:
6
http://hg.ecmascript.org/tests/test262/file/53c4ade82d14/test/suite/ch15/15.3/15.3.5/15.3.5.4/15.3.5.4_2-2gs.js#l6
/**
7
Should be: 'caller' to false :)
On Thu, Nov 29, 2012 at 9:10 AM, Dave Fugate dave.fug...@gmail.com wrote:
'caller' to true
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
It's a bit unclear to me how arrow functions react to semicolons, for
example:
var a = (c) = {
var b = 2;
b * c;
}
a(4);
Hmmm... I was under the impression that arrow functions with normal
function bodies do *not* implicitly return anything. Maybe I need to
adjust my spec goggles,
I really don't understand what is exactly the advantage of considering
inherited properties for descriptors.
If you create a new instance with those properties using a class to avoid
writing them ... what are you gaining against a literal object?
If you are doing this in order to have less code
Kevin Smith wrote:
It's a bit unclear to me how arrow functions react to semicolons,
for example:
var a = (c) = {
var b = 2;
b * c;
}
a(4);
Hmmm... I was under the impression that arrow functions with normal
function bodies do *not* implicitly return
On Thu, Nov 29, 2012 at 8:49 AM, Kevin Smith khs4...@gmail.com wrote:
It's a bit unclear to me how arrow functions react to semicolons, for
example:
var a = (c) = {
var b = 2;
b * c;
}
a(4);
Hmmm... I was under the impression that arrow functions with normal
function bodies do
On Thu, Nov 29, 2012 at 9:41 AM, Brendan Eich bren...@mozilla.org wrote:
Kevin Smith wrote:
It's a bit unclear to me how arrow functions react to semicolons,
for example:
var a = (c) = {
var b = 2;
b * c;
}
a(4);
Hmmm... I was under the impression
On Thu, Nov 29, 2012 at 7:42 PM, Rick Waldron waldron.r...@gmail.comwrote:
On Thu, Nov 29, 2012 at 9:41 AM, Brendan Eich bren...@mozilla.org wrote:
Kevin Smith wrote:
It's a bit unclear to me how arrow functions react to semicolons,
for example:
var a = (c) = {
var
Andrea Giammarchi wrote:
I really don't understand what is exactly the advantage of considering
inherited properties for descriptors.
It's easy to overreact here. Don't mess with Object.prototype still
applies, or you will have other WTF moments.
ES5 shipped this and browsers shipped
Or to null, which is exactly what the new semantics decided to do. ;)
/Andreas
On 29 November 2012 17:11, Dave Fugate dave.fug...@gmail.com wrote:
Should be: 'caller' to false :)
On Thu, Nov 29, 2012 at 9:10 AM, Dave Fugate dave.fug...@gmail.com wrote:
'caller' to true
I will ... but I still would like to know why other developers are using
inheritance for this.
No memory, performance, size, benefits and more verbose code, i.e.
Object.defineProperty(o, p, Object.create(null, {value:{value:v}}))
OR
Object.defineProperty(o, p, new DefaultDescriptor(v));
VS
Here's a place I've made use of it, note Descriptor and Descriptors.
https://github.com/Benvie/benvie.github.com/blob/master/client/modules/site/introspect.js#L221
___
es-discuss mailing list
es-discuss@mozilla.org
that's actually cool, but you suffer same problem? :-)
desc.enumerable = 'get' in desc;
On Thu, Nov 29, 2012 at 1:07 PM, Brandon Benvie
bran...@brandonbenvie.comwrote:
Here's a place I've made use of it, note Descriptor and Descriptors.
Updated MDN:
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty#Description
Hope it's fine, feel fere to edit/add/change that, thanks
On Thu, Nov 29, 2012 at 12:23 PM, Andrea Giammarchi
andrea.giammar...@gmail.com wrote:
I will ... but I still
23 matches
Mail list logo