Conformance to the ExpressibleByStringLiteral
makes it possible to create dangerous situation
#63
Unanswered
letko-dmitry
asked this question in
Q&A
Replies: 1 comment
-
@letko-dmitry This is working as intended and holds true for We consider this kind of assignment to be a programmer error, since literals are only ever added by programmers working on the project. That said, we'd be open to introducing more explicit preconditions in the string initializers that better describe the problem, as they exist in the array literal conformance above. We'd also be open to exploring how macros may solve for this at compile-time, e.g.: #nonEmpty("")
┬─
╰ 🛑 Cannot use empty literal with '#nonEmpty' Because we don't consider this a bug in the library, I'm going to convert it to a discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It looks like conforming to the
ExpressibleByStringLiteral
protocol isn't safe and leads to the following use case:And obviously it is a silenced crash.
The same for all the other initializators like this.
As far as I see, it was discussed before there: #48 (comment). Don't you think that avoiding cases like the one above is the exact reason of having such a solution?
Beta Was this translation helpful? Give feedback.
All reactions