On 17 August 2012 20:54, Brendan Eich bren...@mozilla.org wrote:
Andreas Rossberg wrote:
On 16 August 2012 23:47, Brendan Eichbren...@mozilla.org wrote:
Andreas Rossberg wrote:
-1 as an out-of-band (for non-negative indexes) return code is actually
easier to test
Why is it easier to
Andreas Rossberg wrote:
Hm, I don't see how this example relies on an in-band sentinel. The
loop condition would work just as well with a comparison to undefined.
Everything else is regular argument values.
This loop could indeed test
while ((i = s.indexOf(' ', j)) !== undefined) ...
That
Brendan Eich wrote:
Andreas Rossberg wrote:
Hm, I don't see how this example relies on an in-band sentinel. The
loop condition would work just as well with a comparison to undefined.
Everything else is regular argument values.
This loop could indeed test
while ((i = s.indexOf(' ', j)) !==
Brendan Eich wrote:
I will take the charge of contrived but still maintain that -1
rather than undefined can be useful (as in used in a further index
computation), while undefined either needs a test to special-case (and
avoid hard-to-see implicit conversion), or else a conversion to NaN
that
In light of this thread and the recent discussion about some kind of .?
operator, I thought it'd be cool to actually make this and try it out. By
having a bit of fine with the V8 API's* _MarkAsUndetectable_ *function and
building on top of that, I was able to make a node module as an experiment
Well, I was thinking !== null for most tests I guess but I could see
potential for typeof in the simpler methods that return other stuff.
So by this standard would:
'squirrel'.match(/wombat/);
be better if it returned an empty array rather than null? If that's the
case, then I guess I wanted to
On 16 August 2012 23:47, Brendan Eich bren...@mozilla.org wrote:
Andreas Rossberg wrote:
On 16 August 2012 00:35, Rick Waldronwaldron.r...@gmail.com wrote:
It would be far worse to have a different type of value as a return,
right?
Actually, no. It is far better to have something that
Erik Reppen wrote:
Well, I was thinking !== null for most tests I guess but I could see
potential for typeof in the simpler methods that return other stuff.
So by this standard would:
'squirrel'.match(/wombat/);
be better if it returned an empty array rather than null?
Probably not. Again,
Erik Reppen wrote:
myPocketD( function(){ //altered proto methods swapped before this
func arg is fired and then swapped back after it closes
[0,1].join(''); //alerts 'Somebody did something awful to the
Array join method!'
//you could pretty much write your entire app in spaces like
I think at this time I would definitely favor consistent negative returns
in a higher-level user-defined library or framework where the nuts and
bolts type-stuff is dealt with for you, but I think I can see the point of
not going that route for the core language API. Or at least in any case,
I'm
Sorry: mailing-list noob and I forget to CC es-discuss.
Nothing wrong with join(''). If anything I'm a bit overly fond of
split/join approaches to problems. My only point was that I could do
something awful to the join method (like changing it to alert that stupid
message regardless of args) only
Andreas Rossberg wrote:
On 16 August 2012 23:47, Brendan Eichbren...@mozilla.org wrote:
Andreas Rossberg wrote:
On 16 August 2012 00:35, Rick Waldronwaldron.r...@gmail.com wrote:
It would be far worse to have a different type of value as a return,
right?
Actually, no. It is far better to
On 16 August 2012 00:35, Rick Waldron waldron.r...@gmail.com wrote:
On Wed, Aug 15, 2012 at 6:02 PM, Erik Reppen erik.rep...@gmail.com wrote:
This topic has probably been beaten to death years before I was even aware
of es-discuss but it continues to get mentioned occasionally as a point of
Le 16/08/2012 03:11, Erik Reppen a écrit :
Well I went a bit long as I tend to when geeking out on stuff but I
think the topic of how these elements of the language could be used
better moving forward if we're stuck with 'em is interesting. I really
do find it's helpful in debug to have
On Thursday, August 16, 2012 at 5:24 AM, Andreas Rossberg wrote:
On 16 August 2012 00:35, Rick Waldron waldron.r...@gmail.com wrote:
On Wed, Aug 15, 2012 at 6:02 PM, Erik Reppen erik.rep...@gmail.com wrote:
This topic has probably been beaten to death years before I was even aware
@Rick Bah, mailing-lists. Sorry about the dupe e-mail. I forgot to reply to
all.
I absolutely agree with not permanently altering existing core library
methods if you can avoid it. I guess I was thinking more of jQuery's
adapter/decorator approach vs the somewhat more extreme (IMO) step of
Yeah, I could've been more clear. I didn't expect anybody to rewrite JS in
two weeks and the vendors to implement a dual-interpreter that would patch
things up with a new 'use erik.preferences'; statement (although if all
relevant parties were to offer... I have a birthday next year, that's all
On Thu, Aug 16, 2012 at 12:02 AM, Erik Reppen erik.rep...@gmail.com wrote:
So for the sake of consistency/sanity in future methods, at least, how about
establishing the following guidelines somewhere on the usage of these
values?
* More specific negative-result values are reserved for simple
Norbert Lindenberg wrote:
On Aug 15, 2012, at 15:35 , Rick Waldron wrote:
On Wed, Aug 15, 2012 at 6:02 PM, Erik Reppenerik.rep...@gmail.com wrote:
* 'wombat'.charAt(20); //returns an empty string, but that's a concrete value
whereas 'wombat'[20] returns undefined
For the same reason
Andreas Rossberg wrote:
On 16 August 2012 00:35, Rick Waldronwaldron.r...@gmail.com wrote:
On Wed, Aug 15, 2012 at 6:02 PM, Erik Reppenerik.rep...@gmail.com wrote:
This topic has probably been beaten to death years before I was even aware
of es-discuss but it continues to get mentioned
This topic has probably been beaten to death years before I was even aware
of es-discuss but it continues to get mentioned occasionally as a point of
pain so I thought I'd see if I couldn't attempt to hatch a conversation and
maybe understand the design concerns better than I likely do now.
Le 16/08/2012 00:35, Rick Waldron a écrit :
On Wed, Aug 15, 2012 at 6:02 PM, Erik Reppen erik.rep...@gmail.com
mailto:erik.rep...@gmail.com wrote:
Is consistent type return a heuristic carried over from more
strictly-typed paradigms or would it murder performance of the
On Aug 15, 2012, at 15:35 , Rick Waldron wrote:
On Wed, Aug 15, 2012 at 6:02 PM, Erik Reppen erik.rep...@gmail.com wrote:
* 'wombat'.charAt(20); //returns an empty string, but that's a concrete
value whereas 'wombat'[20] returns undefined
For the same reason indexOf always returns a
23 matches
Mail list logo