> > - "nitems" looks like "number of items" (i.e., "length"); why not > > "numSetItems" or "countSetItem"? > > Yeah, I didn't think it was very descriptive either, but it returns the > number of non null/undefined items in the array (which, at the moment, I > don't see as very useful, hehe). Perhaps it could be notNullCount()?
Yes, even better than my suggestions (or "countNotNull"). > This method actually inspires me to create a more useful method that I > think is missing: count. Nice. > > - "some" -- maybe "forSome", or "exists"? (Also, "every" makes more > > sense to me as "forAll".) > > every and some come from php. But you bringing this up made me think > about it, and I've concluded that 'any' is a more descriptive method > name (and one less character to type!). 'any' and 'every' go together > well (like chocolate and peanut butter). I've renamed 'some' to 'any'. In mathematics these are the quantifiers written as an upside-down "A" and a backwards "E", respectively. They are usually read (and often written) as "for all" and "[there] exists" or "for some"--hence my suggestions. There must be equivalent Java functions somewhere (and ActionScript is far more akin to Java than PHP or Ruby). > > - "eql" -- "equals" is far more standard > > eql is what is used in Ruby, while Java uses equals. I don't know if > there's a clear standard. I like Ruby. I think it's a great language. > I have no problem with shaving a few chars off for quicker typing, > especially if "equals" ever enters into the language. eql is more > likely to not conflict with anything. But, as pointed out before, ActionScript is far more akin to Java, where "equals" is something just about every single object has. Furthermore, some Flash objects (e.g., Point), already use "equals". Finally, "eql" looks a lot like "leq". > > - "include" is pretty close to a reserved word > > You're right. I've renamed it 'has', which I think is perfect, and, > coincidentally, still maintains alphabetical order without having to > move it. :) Nice. > > - the "delete" functions don't so much "delete" (i.e., totally destroy) > > as "remove" or "strip". > > They do delete - from the Array. This method belongs to the Array > class. Hence, it's doing exactly what it says and what you expect - > deleting an element from the Array. Once you delete it from the Array, > it's no longer in the Array. It's not Object.delete, it's Array.delete. > > Delete is the original name of the method in Ruby, but delete is a Flash > native method and cannot be assigned to a function. So, I've used > deleteAll, deleteAt and deleteIf. There is no Object.delete or Array.delete, nor can there be, since "delete" is a keyword--not a native method (like, say, "trace" or "setInterval"), but part of the language itself (like "new"--same as in C and Java and PHP). "Deleting" means you are utterly destroying the object--essentially forcing garbage collection. "Removing" means you are taking it out of the array (but it might still be referenced somewhere else). I think you should only use "delete" (or "destroy") as part of the name if you are actually forcing deletion, not if you are just removing a reference. In short, I don't think it's a good idea to use Ruby or PHP conventions in ActionScript. Look to other ActionScript conventions first, then look to Java conventions. Niggling points, I know, but legible code is worth some thought, I think. -- T. Michael Keesey _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com