supermarin / ObjectiveSugar

ObjectiveC additions for humans. Ruby style.
MIT License
2.17k stars 190 forks source link

Fix some typo and mistake in README. Change NSArray's objectForKeyedSubscript: action #36

Closed onevcat closed 10 years ago

onevcat commented 11 years ago

Change objectForKeyedSubscript: of NSArray from simply range make to a ruby-like range literals. It make little sense by using a ruby syntax of range (..) but doing something like making NSRange with location and length. It might be a confusing, especially this syntax is designed to simulate some ruby syntax.

Using '..' run from the beginning to the end inclusively, and '…' for exclude the end value. For making range from string, using 'x,y' might be a good idea.

Please be caution 001ee18 will broke the objectForKeyedSubscript: api, but I believe it worth to change it earlier. bfbb414 is just fix a mistake in readme file.

nmtitov commented 11 years ago

Hey, I think thats good commit. I'd also like to see possibility to do [..-1] and [1..] and so on (basically, skip values from beginning and from end)

supermarin commented 10 years ago

@onevcat really nice patch, I wasn't really sure why it behaved that way before until you've pointed out.

The production method needs some refactoring, but it's not necessary for merging this one. Since you've written nice tests, anyone can do it later.