[Issue] Collection.distance() works not very well in some situations
The question is that, whether the original Collection Protocol requires index
from lower to higher (startIndex < endIndex).
If the original Collection Protocol requires index from lower to higher, than
this infinity loop should
Hi everyone,
I'd like to discuss the relation between RangeReplaceableCollection and
MutableCollection
MutableCollection is a Collection type that can { set } any element with
subscript(position: Index). (and also { set } for subscript(range:
Range))
RangeReplaceableCollection requires a func
I used the swift-4.1-DEVELOPMENT-SNAPSHOT-2017-11-30-a-osx to test:
Welcome to Apple Swift version 4.1-dev (LLVM 05fee6ff60, Clang f0e38d2044,
Swift a1441d34f7). Type :help for assistance.
1> [[1]] == [[1]]
error: repl.swift:1:7: error: binary operator '==' cannot be applied to two
'[[Int]]' o
Yes. ‘replaceSubrange(myRange, with: newCharacters)’ is different than
subscript, because it may change the length.
But any subscript could do that replaceSubrange could do, right?
在 2017年12月5日,10:48,Brent Royal-Gordon 写道:
>> On Dec 2, 2017, at 12:31 PM, Cao, Jiannan via swi
17, at 12:31 PM, Cao, Jiannan via swift-dev
>> wrote:
>>
>> I'd like to discuss the relation between RangeReplaceableCollection and
>> MutableCollection
>>
>> MutableCollection is a Collection type that can { set } any element with
>> subscript(po
s 写道:
>
>
>
> Sent from my iPhone
>
>> On Dec 5, 2017, at 12:19 AM, Cao, Jiannan via swift-dev
>> wrote:
>>
>>
>> But, I mean, what subscript (restrict to the length) could do is subset of p
>> replaceSubrange could do, right?
>
>
Hi everyone,
I have a question about StringProtocol.
Since String and Substring are adopted RangeReplaceableCollection, why
StringProtocol not inherit RangeReplaceableCollection?
Also consider StringProtocol could inherit:
CustomDebugStringConvertible
CustomPlaygroundQuickLookable
CustomReflecta
Hi everyone,
I have a question about StringProtocol.
Since String and Substring are adopted RangeReplaceableCollection, why
StringProtocol not inherit RangeReplaceableCollection?
Also consider StringProtocol could inherit:
CustomDebugStringConvertible
CustomPlaygroundQuickLookable
CustomReflecta
Recently, we can use conditional conformances for struct/class.
> extension Array: Equatable where Self.Element : Equatable { ... }
Could we use conditional conformances for protocols?
For example:
> extension Collection : Equatable where Self.Element : Equatable { ... }
Thanks!
Jiannan
__
Hi,
I would like to discuss the String.Index problem within Swift. I know the
current situation of String.Index is based on the nature of the underlaying
data structure of the string.
But could we just make String.Index contain offset information? Or make offset
index subscript available for a
up in real life? The most common
> cases I see are trying to strip off the first or last character, or a known
> prefix or suffix, and I feel like we should have better answers for those
> than "use integer indexes" anyway.
>
> Jordan
>
>
>> On Dec 13, 2
String).
These two offset is totally different.
Best,
Jiannan
> 在 2017年12月15日,上午9:17,Michael Ilseman <mailto:milse...@apple.com>> 写道:
>
>
>
>> On Dec 14, 2017, at 4:49 PM, Cao, Jiannan via swift-dev > <mailto:swift-dev@swift.org>> wrote:
>>
>> Pe
concept of UTF-16.
> 在 2017年12月15日,上午9:25,Cao, Jiannan via swift-dev 写道:
>
> This offset is unicode offset, is not the offset of element.
> For example: index(startIndex, offsetBy:1) is encodedOffset 4 or 8, not 1.
>
> Offset indexable is based on the offset of count of each
Hi all,
I have come up an improvement point about Optional Chain Assignment
1. Optional Chain Assignment not working with tuple assignment
optional chain assignment only work for directly assignment, not working with
tuple assignment.
For example:
struct ListNode {
var next: ListNode?
}
ifferent.
>>
>> Best,
>> Jiannan
>>
>>> 在 2017年12月15日,上午9:17,Michael Ilseman >> <mailto:milse...@apple.com>> 写道:
>>>
>>>
>>>
>>>> On Dec 14, 2017, at 4:49 PM, Cao, Jiannan via swift-dev
>>>> mail
g data offset meaning to the UTF-16 String).
>>
>> These two offset is totally different.
>>
>> Best,
>> Jiannan
>>
>>> 在 2017年12月15日,上午9:17,Michael Ilseman >> <mailto:milse...@apple.com>> 写道:
>>>
>>>
>>>
>>>>
g data offset meaning to the UTF-16 String).
>>
>> These two offset is totally different.
>>
>> Best,
>> Jiannan
>>
>>> 在 2017年12月15日,上午9:17,Michael Ilseman >> <mailto:milse...@apple.com>> 写道:
>>>
>>>
>>>
>>>>
The encodedOffset is the underlaying offset of unicode string, not the same
>>> concept of the offset index of collection.
>>>
>>> The offset indexable is meaning to the elements and index of collection
>>> (i-th element of the collection), not related to the uni
fset is totally different.Best,Jiannan在 2017年12月15日,上午9:17,Michael Ilseman <milse...@apple.com> 写道:On Dec 14, 2017, at 4:49 PM, Cao, Jiannan via swift-dev <swift-dev@swift.org> wrote:People used to the offset index system instead of the String.Index. Using offset indices to name the e
19 matches
Mail list logo