-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StaticString until StaticBigInt #62
Comments
I suppose one somewhat surprising thing is that conforming to ExpressibleByStringLiteral causes |
one remark - enable String Literal for SBI too. Right now it will be disabled when the SBI flag is set. They can both be present.
|
You're right that these methods can coexist, but should they when one is clearly better? I suppose I can alleviate some migration pain by conditionally deprecating it. Or, do you have a use case in mind that prefers #if swift(>=5.8) && SBI
@available(swift, deprecated: 5.8, message: "Use an integer literal instead.")
#endif
@inlinable public init(stringLiteral source: StringLiteralType) { ... } |
I think it can be used with some APIs which return strings with prefixes even if we have StaticBigInt. Maybe JSON-based API with big integers in it as hex values. I don't think it should be deprecated. It's better than radix methods because it checks the prefix of the string. |
In that case, wouldn't it be better to have a dedicated method? Perhaps with some format parameters. #if swift(>=5.8) && SBI
@available(swift, deprecated: 5.8, message: "Use an integer literal instead.")
#endif
@inlinable public init(stringLiteral: StringLiteralType) {
self.init(fromStringLiteralButBetter: stringLiteral, optionalRadixOrSomething: 10)
} |
the method is good too. But I think we shouldn't force developers. If someone wants to use string literals - ok. Maybe they want to support older OSes without ifdefs even when they have StaticBigInt |
I've been thinking. I'll keep depreciating |
I changed |
I'll remove the deprecation because there isn't an automatic way of enabling StaticBigInt via availability. |
Lowering the minimum platform requirements (#61) means that StaticBigInt be disabled by default. I'll add an ExpressibleByStringLiteral conformance to NBKDoubleWidth in its place. It will work like
init(_:radix:)
except it will also support the 3 most common radix prefixes:0b
,0o
and0x
. So, ideally, the change is reduced to adding quotation marks.The text was updated successfully, but these errors were encountered: