On Friday, November 2, 2012 at 1:56 PM, Jason Orendorff wrote:

> On Fri, Nov 2, 2012 at 12:29 PM, Domenic Denicola 
> <dome...@domenicdenicola.com (mailto:dome...@domenicdenicola.com)> wrote:
> > > If we call it "has", should we also rename String.prototype.contains?
> > 
> > I'd say no; the distinction between collections "having" an element and 
> > strings "containing" a substring seems very sensible. It's a bit more 
> > awkward to say a string "has" a substring, and a string is definitely not a 
> > collection of substrings in any reasonable sense.
> 
> Well, you could also note that array.has(x) looks for a particular value, 
> while map.has(x) looks for a particular key.
> 
> But that's not the point. There's no common formal contract implemented by 
> all these methods; what they share is an informal "hey, look in this thing, 
> and tell me if you see that thing" vibe.
> 
> I like the idea of being able to say str.has(",") or str.has("=>") or 
> str.has("@jorendorff") and have them all just work.
This is definitely nice :)

Jason, Erik, Mark,

Any specific thoughts about the SameValue case as it likely doesn't apply to a 
hypothetical String.prototype.has impl.? I suspect that a string had would 
still use indexOf which would introduce an internal inconsistency for the sake 
of API consistency (which I'm all for). Unless I'm overlooking?

Rick 
 
> 
> -j
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 
> 


_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to