Le 09/11/2011 02:26, Andrew Paprocki a écrit :
On Tue, Nov 8, 2011 at 6:36 PM, Brendan Eichbren...@mozilla.com wrote:
Ignoring performance, a lot of stylish JS hackers use Object.keys(o).forEach.
How many run into the wrong |this| (arguments/break/continue/return)? Not
clear. Something to
On Wed, Nov 9, 2011 at 3:40 PM, Jorge jo...@jorgechamorro.com wrote:
On 08/11/2011, at 22:17, John J Barton wrote:
Just as a point of comparison, I use this form:
Object.keys(o).forEach( function(key) {
body
});
By the way, isn't that above a(nother) good use case for a goto,
On Nov 9, 2011, at 12:40 PM, Jorge wrote:
On 08/11/2011, at 22:17, John J Barton wrote:
Just as a point of comparison, I use this form:
Object.keys(o).forEach( function(key) {
body
});
By the way, isn't that above a(nother) good use case for a goto, given that
there's no (easy)
On Wed, Nov 9, 2011 at 4:05 PM, Brendan Eich bren...@mozilla.com wrote:
On Nov 9, 2011, at 12:40 PM, Jorge wrote:
On 08/11/2011, at 22:17, John J Barton wrote:
Just as a point of comparison, I use this form:
Object.keys(o).forEach( function(key) {
body
});
By the way, isn't
On Nov 9, 2011, at 1:15 PM, Dean Landolt wrote:
On Wed, Nov 9, 2011 at 4:05 PM, Brendan Eich bren...@mozilla.com wrote:
On Nov 9, 2011, at 12:40 PM, Jorge wrote:
On 08/11/2011, at 22:17, John J Barton wrote:
Just as a point of comparison, I use this form:
Object.keys(o).forEach(
On Wed, Nov 9, 2011 at 4:20 PM, Brendan Eich bren...@mozilla.com wrote:
On Nov 9, 2011, at 1:15 PM, Dean Landolt wrote:
On Wed, Nov 9, 2011 at 4:05 PM, Brendan Eich bren...@mozilla.com wrote:
On Nov 9, 2011, at 12:40 PM, Jorge wrote:
On 08/11/2011, at 22:17, John J Barton wrote:
Just as
On Nov 9, 2011, at 1:33 PM, Quildreen Motta wrote:
On 09/11/11 19:20, Brendan Eich wrote:
And if you need to break out of forEach, just, umm, don't use forEach. It's
the wrong tool for the job.
Clearly people like the forEach array extra in conjunction with Object.keys.
With
On Nov 9, 2011, at 1:33 PM, Dean Landolt wrote:
And if you need to break out of forEach, just, umm, don't use forEach. It's
the wrong tool for the job.
Clearly people like the forEach array extra in conjunction with Object.keys.
Aye, but I suspect that's because many people don't
And if you need to break out of forEach, just, umm, don't use forEach. It's
the wrong tool for the job.
Clearly people like the forEach array extra in conjunction with Object.keys.
With block-lambdas they could have their cake and break from it too (and the
call would be paren-free to
On Nov 9, 2011, at 2:43 PM, Axel Rauschmayer wrote:
Do block-lamdbas count as a fix for the dynamic this problem?
Definitely.
Or are there other plans to get it solved? I would still love to see that
happen, it’s a remarkably subtle source of errors. Could functions adopt the
Should ES.next provide sugar for the recommended pattern? To make it compose
with declarations and destructuring in the for head, it should use a
contextual keyword immediately after 'for':
for own (i in o) {
body
}
This is a small thing but it might pay off in the long run.
On 09/11/2011, at 22:05, Brendan Eich wrote:
On Nov 9, 2011, at 12:40 PM, Jorge wrote:
On 08/11/2011, at 22:17, John J Barton wrote:
Just as a point of comparison, I use this form:
Object.keys(o).forEach( function(key) {
body
});
By the way, isn't that above a(nother) good use case for
The recommended practice when writing for-in loops in JS today is to write:
for (i in o) {
if (o.hasOwnProperty(i)) {
body
}
}
Although many JS developers do not follow the recommendation (out of ignorance
or intentionally, doesn't matter).
Should ES.next provide sugar for
On 11/8/11 2:49 PM, Brendan Eich wrote:
Should ES.next provide sugar for the recommended pattern? To make it
compose with declarations and destructuring in the for head, it should
use a contextual keyword immediately after 'for':
for own (i in o) {
/body/
}
This is a small thing but it might
On Tue, Nov 8, 2011 at 12:49 PM, Brendan Eich bren...@mozilla.com wrote:
The recommended practice when writing for-in loops in JS today is to write:
for (i in o) {
if (o.hasOwnProperty(i)) {
body
}
}
Although many JS developers do not follow the recommendation (out of
I see two domains for the concept of “own” properties:
1. Meta-programming.
2. Using objects as dictionaries.
Isn’t #2 the majority (at least as far as non-library-programmers are
concerned)? Will the concept become less relevant once we have David Herman’s
dicts?
I also like the Python-style
On Tue, Nov 8, 2011 at 3:49 PM, Brendan Eich bren...@mozilla.com wrote:
for own (i in o) {
*body*
}
This is a small thing but it might pay off in the long run.
This is a very useful feature ... but for better or for worse, also shows
off how much paren-free would help things. for
Yes, I think JS needs something like this. This is new to no one here, but
my main concern with using hasOwnProperty is the loss of performance, so I
think it would be worth exploring more than just syntactic sugar. But I
don't know how realistic it is to hope for that.
for own (i in o) {
body
}
What happened to @iter.keys and 'for (key of keys) {}'?
http://wiki.ecmascript.org/doku.php?id=harmony:iterators
Claus
http://clausreinke.github.com/
http://clausreinke.github.com/js-tools/
___
es-discuss mailing
On 08/11/11 18:49, Brendan Eich wrote:
The recommended practice when writing for-in loops in JS today is to
write:
for (i in o) {
if (o.hasOwnProperty(i)) {
/body/
}
}
Although many JS developers do not follow the recommendation (out of
ignorance or intentionally, doesn't
On 08/11/11 19:19, Axel Rauschmayer wrote:
I see two domains for the concept of “own” properties:
1. Meta-programming.
Could you expand on the use of `own' properties for meta-programming?
I'm afraid I can't really envision it =/
2. Using objects as dictionaries.
Isn’t #2 the majority (at
Le 08/11/2011 21:49, Brendan Eich a écrit :
The recommended practice when writing for-in loops in JS today is to
write:
for (i in o) {
if (o.hasOwnProperty(i)) {
/body/
}
}
As said in the thread your forked from, this practice is often
recommended to not enumerate Object.prototype
I see two domains for the concept of “own” properties:
1. Meta-programming.
Could you expand on the use of `own' properties for meta-programming? I'm
afraid I can't really envision it =/
Whenever you copy properties from one object to another one, you are usually
doing meta-programming
On Tue, Nov 8, 2011 at 1:45 PM, Timmy Willison timmywill...@gmail.com wrote:
Yes, I think JS needs something like this. This is new to no one here, but
my main concern with using hasOwnProperty is the loss of performance, so I
think it would be worth exploring more than just syntactic sugar.
On Nov 8, 2011, at 1:19 PM, Axel Rauschmayer wrote:
I see two domains for the concept of “own” properties:
1. Meta-programming.
2. Using objects as dictionaries.
Thanks, good to focus on use-cases. Both would like shorthand and freedom from
Object.prototype.hasOwnProperty tamper-proofing.
On Nov 8, 2011, at 1:19 PM, Jeremy Ashkenas wrote:
On Tue, Nov 8, 2011 at 3:49 PM, Brendan Eich bren...@mozilla.com wrote:
for own (i in o) {
body
}
This is a small thing but it might pay off in the long run.
This is a very useful feature ... but for better or for worse, also
On Nov 8, 2011, at 1:48 PM, Claus Reinke wrote:
for own (i in o) {
body
}
What happened to @iter.keys and 'for (key of keys) {}'?
Still there, but write it out fully, to compare to the cited text:
import keys from @iter;
for (i of keys(o)) {
body
}
Unless we default-import a
On 08/11/11 20:22, Axel Rauschmayer wrote:
I see two domains for the concept of “own” properties:
1. Meta-programming.
Could you expand on the use of `own' properties for meta-programming?
I'm afraid I can't really envision it =/
Whenever you copy properties from one object to another one,
On Nov 8, 2011, at 2:03 PM, Quildreen Motta wrote:
On 08/11/11 18:49, Brendan Eich wrote:
The recommended practice when writing for-in loops in JS today is to write:
for (i in o) {
if (o.hasOwnProperty(i)) {
body
}
}
Although many JS developers do not follow the
I see two domains for the concept of “own” properties:
1. Meta-programming.
2. Using objects as dictionaries.
Thanks, good to focus on use-cases. Both would like shorthand and freedom
from Object.prototype.hasOwnProperty tamper-proofing.
Isn’t #2 the majority (at least as far as
On Nov 8, 2011, at 2:26 PM, John J Barton wrote:
On Tue, Nov 8, 2011 at 1:45 PM, Timmy Willison timmywill...@gmail.com wrote:
Yes, I think JS needs something like this. This is new to no one here, but
my main concern with using hasOwnProperty is the loss of performance, so I
think it would
On Nov 8, 2011, at 2:26 PM, John J Barton wrote:
On Tue, Nov 8, 2011 at 1:45 PM, Timmy Willison timmywill...@gmail.com wrote:
Yes, I think JS needs something like this. This is new to no one here, but
my main concern with using hasOwnProperty is the loss of performance, so I
think it would
On Tue, Nov 8, 2011 at 6:36 PM, Brendan Eich bren...@mozilla.com wrote:
Ignoring performance, a lot of stylish JS hackers use Object.keys(o).forEach.
How many run into the wrong |this| (arguments/break/continue/return)? Not
clear. Something to study.
I was curious so I did some grok-ing
On 08/11/11 21:36, Brendan Eich wrote:
Ignoring performance, a lot of stylish JS hackers use Object.keys(o).forEach.
How many run into the wrong |this| (arguments/break/continue/return)? Not
clear. Something to study.
Well, I use Object.keys, etc, a lot thorough my code. I can't remember a
On Tue, Nov 8, 2011 at 11:36 PM, Brendan Eich bren...@mozilla.com wrote:
Ignoring performance, a lot of stylish JS hackers use
Object.keys(o).forEach. How many run into the wrong |this|
(arguments/break/continue/return)? Not clear. Something to study.
/be
I personally use `Object.keys()`
On 08/11/11 23:59, Jake Verbaten wrote:
However on average a lot more people will use for ... in with
hasOwnProperty because ES5 environments are rare and a lot of people
avoid the ES5-shim
Do you mean `rare' as in they have to work with the lowest common
denominator (IE)? Because
In the real world IE9 still accounts for almost 50% of browsers. Then
there's another 6% for FF3.6 and another 3% for opera.
As much as I like promoting that you should ignore legacy browsers, for
most people 50% market share is a good enough reason to support them.
On Wed, Nov 9, 2011 at 2:03
Still there, but write it out fully, to compare to the cited text:
import keys from @iter;
for (i of keys(o)) {
body
}
Unless we default-import a standard prelude,
I think we should.
this is a bit much compared to add own as a modifier after for in for/in (not
for/of)
On Nov 8, 2011, at 9:08 PM, Jake Verbaten rayn...@gmail.com wrote:
In the real world IE9 still accounts for almost 50% of browsers. Then
there's another 6% for FF3.6 and another 3% for opera.
Latest Opera builds are 100% ES5.1 compliant. (according to opera dev-rel)
As much as I like
On Nov 8, 2011, at 8:39 PM, David Herman wrote:
Instead of taking a hard-to-use-right form like for-in and partly taming it,
I'd rather suggest people simply move to for-of, and have the default keys
iterator Do The Right Thing and only iterate over own, enumerable property
names (thanks
Let's answer this once we have the module-ized version of the standard library.
Which I've been promising for far too long (mea culpa). Will get started on
this tonight.
Dave
On Nov 8, 2011, at 9:04 PM, Brendan Eich wrote:
On Nov 8, 2011, at 8:39 PM, David Herman wrote:
Instead of taking
On Tue, Nov 8, 2011 at 9:03 PM, Rick Waldron waldron.r...@gmail.com wrote:
Latest Opera builds are 100% ES5.1 compliant. (according to opera dev-rel)
The latest externally visible Opera is Opera 12 alpha build 1116. It is
indeed very close to ES5.1 compliant. But it still fails
On Wed, Nov 9, 2011 at 12:12 AM, Mark S. Miller erig...@google.com wrote:
On Tue, Nov 8, 2011 at 9:03 PM, Rick Waldron waldron.r...@gmail.comwrote:
Latest Opera builds are 100% ES5.1 compliant. (according to opera dev-rel)
The latest externally visible Opera is Opera 12 alpha build 1116.
43 matches
Mail list logo