[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-04 Thread T.J. Crowder
I'm with Robert, is there a good use case for these or should we just deprecate them? But if we're going to get into renaming things, Enumerable#include is crying out for an s on the end (if this thing include*s* this other thing then...); without one it seems to say include this argument in the

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-04 Thread Tobie Langel
Hi everyone. There are various reasons to keep those methods around, some of which are: 1) Follow the Principle Of Least Surprise (POLS) by exposing a similar API across the whole platform, 2) simplify duck-typing, and 3) abstract implementation details (for example, Hash#isEmpty isn't as

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-04 Thread artemy tregubenko
String#isEmpty checks not the length of a string, but absence of non-space characters, which is quite useful i.e. in form validation. On Sun, 04 Oct 2009 11:30:00 +0400, T.J. Crowder t...@crowdersoftware.com wrote: I'm with Robert, is there a good use case for these or should we just

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-04 Thread joneff
On Oct 3, 5:24 pm, Robert Kieffer bro...@gmail.com wrote: Quick reality check: Where is the value in String/Array functions that test for emptiness? 'These methods are nothing more than wrappers around code like, if (!aString) ..., or if (!anArray.length) ... - i.e. JS already has perfectly

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-04 Thread Robert Kieffer
Tobie, I find myself wondering what other reasons you might have for keeping these methods, because the arguments you give don't seem to convincing (to me). In fact, it seems like you may have just phrased the same argument three different ways ... On Sun, Oct 4, 2009 at 4:25 AM, Tobie Langel

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-04 Thread Robert Kieffer
On Sun, Oct 4, 2009 at 4:53 AM, joneff jon...@gmail.com wrote: It's worth noting that (!aString) is more or less equal to (String.isUndefinedOrNullOrEmpty) than it is equal to (String.isEmpty). It just means developers have to know the difference between ! aString and aString == ''. 'Don't

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-04 Thread Tobie Langel
Hi all. Can we please try to stay on topic. This thread's topic is about renaming methods whose ruby counterparts were suffixed with a question mark. It would be very helpful to list all of the methods which fall in that category so we have a better idea of the implications of such a change.

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-03 Thread Tobias H. Michaelsen
Prototype.js is an attempt to make Javascript more Ruby-like, so one of the reasons that these methods exists and are named that way, is that they are in Ruby (of cause Javascript lacks the ‘?’ in the method name). http://ruby-doc.org/core/classes/String.html#M000776

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-03 Thread Tobie Langel
It's specifically because JavaScript disallows certain characters in identifiers (such as '?', for example), that we have decided to prefix certain methods with 'is', 'has', etc. for version 1.7 / 2.0. Without neither those characters nor adequate prefixes, the name of certains methods are

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-03 Thread Robert Kieffer
Quick reality check: Where is the value in String/Array functions that test for emptiness? 'These methods are nothing more than wrappers around code like, if (!aString) ..., or if (!anArray.length) ... - i.e. JS already has perfectly good constructs for this. It's great that Prototype is

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-02 Thread Allen Madsen
I'd prefer isEmpty as well. Allen Madsen http://www.allenmadsen.com On Fri, Oct 2, 2009 at 3:34 PM, joneff jon...@gmail.com wrote: I've been pondering on this one for quite a long time -- why is it String#empty instead of String#isEmpty? To me String.empty should be a field equal /

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-02 Thread Samuel Lebeau
I totally agree. `Array#isEmpty` would be useful too. Maybe we should rename those methods and deprecate the original names in 1.7. Best, Samuel. 2009/10/2 Allen Madsen bla...@gmail.com I'd prefer isEmpty as well. Allen Madsen http://www.allenmadsen.com On Fri, Oct 2, 2009 at 3:34 PM,

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-02 Thread Simon Charette
+1 for renaming both. 2009/10/2 Samuel Lebeau samuel.leb...@gmail.com I totally agree. `Array#isEmpty` would be useful too. Maybe we should rename those methods and deprecate the original names in 1.7. Best, Samuel. 2009/10/2 Allen Madsen bla...@gmail.com I'd prefer isEmpty as well.

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-02 Thread Yaffle
+1 for REMOVE this methods --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to