I agree with Lars (and Mark) on this. It would be best if access to 'this'
would throw. Throwing in the actual call to the function seems a bit harsh
since the statement that refers to 'this' might never be reached. Making
the access throw would allow people to at least catch the error and fall
On Sun, Mar 30, 2008 at 6:54 AM, Lars Hansen <[EMAIL PROTECTED]> wrote:
> The third option on the table is that the reference to 'this'
> inside the body of topLevel simply throws an error. This has
> both less and more utility: the function can't discover if it
> was called as a function or a
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Brendan Eich
> Sent: 29. mars 2008 11:05
> To: Mike Shaver; es4-discuss
> Cc: Dean Edwards
> Subject: Re: Array Generics and null
> We would rather:
>
> function topLev
On Mar 22, 2008, at 10:18 PM, Mike Shaver wrote:
> On Sat, Mar 22, 2008 at 4:32 PM, Dean Edwards <[EMAIL PROTECTED]>
> wrote:
>> Dean Edwards wrote:
>>> I think that the problem is that Array generics were added later.
>>>
>>> From bugzilla:
Array.generic(t, ...) is *intended* to be equiva
Mark S. Miller wrote:
> On Mon, Mar 24, 2008 at 10:31 AM, Dean Edwards <[EMAIL PROTECTED]> wrote:
>> It seems we have three choices for Array.forEach(null)
>>
>> 1) Do nothing
>> 2) Throw an exception
>> 3) Use the current object and iterate that
>
> By "current object" do you mean the global
On Sat, Mar 22, 2008 at 1:42 PM, Garrett Smith <[EMAIL PROTECTED]> wrote:
> Array generic methods will be safer if they check their args and throw
> an error - InvalidArgumentError, TypeError, UnlikeError - (whatever).
>
> Invalid: (this will crash Firefox with endless loop):-
> Array.forEach(
On Mon, Mar 24, 2008 at 10:31 AM, Dean Edwards <[EMAIL PROTECTED]> wrote:
> It seems we have three choices for Array.forEach(null)
>
> 1) Do nothing
> 2) Throw an exception
> 3) Use the current object and iterate that
By "current object" do you mean the global object?
> I prefer the first on
Mike Shaver wrote:
> On Sun, Mar 23, 2008 at 2:44 AM, Dean Edwards <[EMAIL PROTECTED]> wrote:
>> I'd prefer Array.forEach(null) to do nothing, just like for (var i in
>> null) does nothing. I'm prepared to be convinced otherwise. :-)
>
> forEach isn't like enumeration, though, it's like the more
On Sun, Mar 23, 2008 at 2:44 AM, Dean Edwards <[EMAIL PROTECTED]> wrote:
> I'd prefer Array.forEach(null) to do nothing, just like for (var i in
> null) does nothing. I'm prepared to be convinced otherwise. :-)
forEach isn't like enumeration, though, it's like the more common
Array pattern of
f
On Sun, Mar 23, 2008 at 11:53 AM, Mike Shaver <[EMAIL PROTECTED]> wrote:
> On Sun, Mar 23, 2008 at 3:45 AM, Garrett Smith <[EMAIL PROTECTED]> wrote:
> > I suspected that. It is the problem with Google Mail, which exhibited
> > a bug in Firefox.
>
> Sorry, do you mean that this is caused by Arra
On Sun, Mar 23, 2008 at 3:45 AM, Garrett Smith <[EMAIL PROTECTED]> wrote:
> I suspected that. It is the problem with Google Mail, which exhibited
> a bug in Firefox.
Sorry, do you mean that this is caused by Array.generic behaviour?
I'm lost as to what bug you're talking about (bug number?).
Mik
On Sun, Mar 23, 2008 at 12:45 AM, Garrett Smith <[EMAIL PROTECTED]> wrote:
> I suspected that. It is the problem with Google Mail, which exhibited
> a bug in Firefox.
>
> Use case:
> 0) hit reply
> 1) click 'send'
> 2) hit 'stop'
> 3) click 'reply to all' and watch the To: field change.
3.5):
Mike Shaver wrote:
> Dean Edwards wrote:
>>> Array.prototype.forEach = function(block, context) {
>>> Array.forEach(this, block, context);
>>> }
>
> I don't see how that helps, unless you expect A.p.g.c(null, f) to
> differ from A.g(null, f) -- the former will need to make a |this|
> from null
On Sat, Mar 22, 2008 at 4:32 PM, Dean Edwards <[EMAIL PROTECTED]> wrote:
> Dean Edwards wrote:
> > I think that the problem is that Array generics were added later.
> >
> > From bugzilla:
> >> Array.generic(t, ...) is *intended* to be equivalent to
> >> Array.prototype.generic.call(t, .
John Resig wrote:
> The issue here is that Array.forEach(null, ...) maps to
> Array.prototype.forEach.call(null, ...) - and doing a .call() on a
> function produces the global object (which, in a browser like
> Firefox, is equivalent to window.frames - looping over the iframes on
> the page).
>
>
On Sat, Mar 22, 2008 at 9:01 AM, John Resig <[EMAIL PROTECTED]> wrote:
> Hello all -
>
> It seems like there could be a couple solutions:
Objects that are not capable of running in an Array-generic should not
be attempted to run.
Would it make sense to use - like - for all the Array generics?
16 matches
Mail list logo