[SR-6950] TextOutputStreamable doesn't play well with Substring #49498
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: b353b5c59fccd6a8cb6bfe95409fd252
Issue Description:
TextOutputStream.write(_:)
takes aString
as input. This means that theTextOutputStreamable
implementation onSubstring
ends up copying the string, even though the whole point of the protocol is to avoid unnecessary string copies.In the short term
Substring
should remove its implementation ofTextOutputStreamable
so as to not be misleading. In the longer term we should have a solution that allows streaming substrings, because this same issue will affect any type that uses substrings internally and still wants to be streamable.The text was updated successfully, but these errors were encountered: