问题
I'm using the @Parcelize
feature in android development using Kotlin language.
To use them I have done the below modifications in build.gradle file.
apply plugin: 'kotlin-android-extensions'
then
androidExtensions {
experimental = true
}
I'm successful in using the above feature. But is it recommended to use them for production release or only for development purpose alone?
回答1:
This isn't just an Android-thing though, it's Kotlin in general. Kotlin has quite a few experimental features, such as coroutines and the android extensions.
If you read the docs, you'll find this:
Experimental features, such as coroutines in Kotlin 1.1, have exemption from the compatibility modes listed above. Such features require an opt-in to use without compiler warning. Experimental features are at least backwards compatible for patch version updates, but we do not guarantee any compatibility for minor version updates (migration aids will be provided where possible).
Experimental features simply mean a different compatibility system. They still work (beta builds fall under EAP, and EAP has no guarantees for compatibility or stability). Experimental features are technically releases, which means they're as stable as any other language feature (as in there can be bugs, which there always can be, but it's intended to be stable).
So if you want to use it in production, do it. The experimental features have different compatibility modes, but they should be as stable as any other language feature. They're "safe" to use in production without much problem. You might have to re-write code if there's an incompatible update, but that's a development problem and not a release problem.
However, the android extensions docs also has a mention of the experimental part:
Android Extensions plugin includes several experimental features such as LayoutContainer support and a Parcelable implementation generator. These features are not considered production ready yet, so you need to turn on the experimental mode [...]
Considering the things I mentioned earlier, this probably means the feature itself isn't finished, equivalently to the coroutines. You can use it in your production releases, but it's not considered a production-ready component of the Kotlin language. And since it's experimental, it has been released. Releases are usually better than EAP versions.
See also this forum post on the Kotlin forums (it mentions coroutines, but some of it applies to other experimental features as well).
And, obviously, if it doesn't work in development, it's most likely not going to work in production either. If something in the extension is completely broken, don't use that specific feature. It doesn't necessarily mean the entire extension is broken though. Generally, even with EAP, if it works, you can use it in production.
来源:https://stackoverflow.com/questions/50855771/experimental-features-in-android-extension-is-good-for-production-release