Re: Array Generics and null

2008-03-31 Thread Erik Arvidsson
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

RE: Array Generics and null

2008-03-30 Thread Lars Hansen
-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 topLevel(a,b,c) { print(this, a, b, c

Re: Array Generics and null

2008-03-30 Thread Mark S. Miller
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 as a

Re: Array Generics and null

2008-03-29 Thread Brendan Eich
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 equivalent to

Re: Array Generics and null

2008-03-24 Thread Mike Shaver
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 for

Re: Array Generics and null

2008-03-24 Thread Dean Edwards
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 common

Re: Array Generics and null

2008-03-24 Thread Mark S. Miller
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 one,

Re: Array Generics and null

2008-03-24 Thread Mike Shaver
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( {

Fwd: Array Generics and null

2008-03-24 Thread Garrett Smith
-- Forwarded message -- From: Garrett Smith [EMAIL PROTECTED] Date: Mon, Mar 24, 2008 at 11:27 AM Subject: Re: Array Generics and null To: Dean Edwards [EMAIL PROTECTED] On Mon, Mar 24, 2008 at 10:31 AM, Dean Edwards [EMAIL PROTECTED] wrote: Mike Shaver wrote: On Sun, Mar

Fwd: Array Generics and null

2008-03-23 Thread Garrett Smith
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. 4) watch Gmail send a mail *instantly*. Gmail displays headers in the 'show details' for all

Array Generics and null

2008-03-22 Thread John Resig
Hello all - I wanted to bring up one point for discussion. Based upon Mozilla's implementation of Array generics (and what will, presumably, be standardized here) you can see that typically doing: Array.forEach(null, function(){alert(arguments);}); produces no alerts. However, performing it

Re: Array Generics and null

2008-03-22 Thread Garrett Smith
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? Is

Re: Array Generics and null

2008-03-22 Thread Mike Shaver
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, ...).