Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-23 Thread Charlie Monroe via swift-evolution
> On Jun 23, 2016, at 4:52 PM, Andreas Ley via swift-evolution > wrote: > >> "..*most* people don’t expect.." could you prove this please? > > I should have written “most people I know” or “the people I work with". > >> Especially if they know a little of C

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-23 Thread Andreas Ley via swift-evolution
> "..*most* people don’t expect.." could you prove this please? I should have written “most people I know” or “the people I work with". > Especially if they know a little of C language or other language that don't > allow to use wrong indexes for arrays. Maybe that’s the point: They don’t. And

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-23 Thread Vladimir.S via swift-evolution
On 23.06.2016 15:48, Andreas Ley wrote: Please find the related proposal which was formed after the long discussion in the list: https://github.com/luish/swift-evolution/blob/proposal-lenient-collection-subscripts/proposals/-more-lenient-collections-subscripts.md Thanks; I have seen

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-23 Thread Andreas Ley via swift-evolution
> Please find the related proposal which was formed after the long discussion > in the list: > > https://github.com/luish/swift-evolution/blob/proposal-lenient-collection-subscripts/proposals/-more-lenient-collections-subscripts.md > >

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-23 Thread Vladimir.S via swift-evolution
Please find the related proposal which was formed after the long discussion in the list: https://github.com/luish/swift-evolution/blob/proposal-lenient-collection-subscripts/proposals/-more-lenient-collections-subscripts.md Here is the pull request on the swift-evolution repo:

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-23 Thread Andreas Ley via swift-evolution
(First time using a mailing list; I hope this message ends up in the correct thread) This is a topic that comes up regularly on the Swift evolution mailing list and off it. After reading through all the respective threads again, there seem to be the following two camps: Arguments made for

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-07 Thread Vladimir.S via swift-evolution
Yes, thank you Jeremy for pointing on this, my fault :-(, was confused by initial description of the problem in proposal and in my fast test I got "Optional(nil)" in console for existed "nil" value in dict, but didn't realized that it should be printed just "nil". On 07.06.2016 19:06, Jeremy

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-07 Thread Jeremy Pereira via swift-evolution
> IMO dictionary [Type1:Type2?] is a special case where you need to use > myDict.keys.contains(keyValue) first to determinate if you have a value for > key and after this you can get the value itself(which is Optional). I don’t understand why you think it is a special case. The return type of

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-07 Thread Vladimir.S via swift-evolution
It seems like you are mixing two proposals: optional result of non-optional array and return value of optional array. I'm commenting the first - as it was already discussed earlier and based on community reaction on it - I believe it will not be supported again. Array is expected to fail fast

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-07 Thread Rob Norback via swift-evolution
Vladimir, thank you for pointing me to the discussion again. I read through the entire thing. And I didn't see a consensus around [Int?]. The main argument against was that it would allow the developer to be clumsy and remain unaware of a problem in the code because the choice is not explicit

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-07 Thread Vladimir.S via swift-evolution
On 06.06.2016 21:02, Rob Norback wrote: First of all, thank you all for bringing me up to date so quickly. I looked over the proposal and it looks awesome. But as Chris mentioned, this doesn't solve the expected behavior and ambiguity of ```Array``` In this case I would expect the

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-06 Thread Christopher Kornher via swift-evolution
> On Jun 6, 2016, at 12:02 PM, Rob Norback via swift-evolution > wrote: > > First of all, thank you all for bringing me up to date so quickly. I looked > over the proposal and it looks awesome. > > But as Chris mentioned, this doesn't solve the expected behavior

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-06 Thread Luis Henrique B. Sousa via swift-evolution
Yes, Rob, even though our proposals are very related, I do think that yours would fit better in a new proposal. My first draft was also in regards to change the default behaviour - not focused on optionals though. It went through a discussion about *masking* the current fail fast behaviour (e.g.

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-06 Thread Rob Norback via swift-evolution
Apologies, please remove the line "Right now myArray[100] = nil gives you EXC_BAD_INSTRUCTION." from my previous email so it makes more sense to read. On Mon, Jun 6, 2016 at 12:02 PM Rob Norback wrote: > First of all, thank you all for bringing me up to date so quickly. I >

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-06 Thread Rob Norback via swift-evolution
First of all, thank you all for bringing me up to date so quickly. I looked over the proposal and it looks awesome. But as Chris mentioned, this doesn't solve the expected behavior and ambiguity of ```Array``` In this case I would expect the default behavior (myArray[4]) without using

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-06 Thread Luis Henrique B. Sousa via swift-evolution
Thanks Vladimir, The correct link is this one (with the additional min/max operations in the implementation): https://github.com/luish/swift-evolution/blob/proposal-lenient-collection-subscripts/proposals/-more-lenient-collections-subscripts.md Here is the pull request on the swift-evolution

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-06 Thread Christopher Kornher via swift-evolution
The proposal needs to discuss arrays of optionals e.g.: ```Array``` These are not just legal, they are quite handy as well. Dictionaries can also be declared with optional values, of course: ```Dictionary``` These can be pretty confusing to deal with and we should not add to

Re: [swift-evolution] Arrays Returning Optionals instead of Index Out of Bounds

2016-06-06 Thread Vladimir.S via swift-evolution
Please find this draft of proposal(hope this is correct link for latest version): https://github.com/luish/swift-evolution/blob/more-lenient-subscripts/proposals/-more-lenient-collections-subscripts.md The main idea is to introduce 2 new subscript methods: [clamping:] and [checking:]