<@U0F8Y5E5A>’s proposal with (more) strict typeali...
# random
m
@mg6maciej’s proposal with (more) strict typealiases looks interesting to me in some cases. https://kotlinlang.slack.com/archives/C0B9K7EP2/p1490383420615905 Example — storing differently sized images’ URLs by side width:
Copy code
typealias UrlsByWidth = SparseArrayCompat<String>
inline fun UrlsByWidth.getForWidth(width: Int) = /* implementation goes here */
/*1*/ @Deprecated(message = "not applicable", level = DeprecationLevel.ERROR) inline fun UrlsByWidth.getForHeight(height: Int) = throw AssertionError()

typealias UrlsByHeight = SparseArrayCompat<String>
/*2*/ inline fun UrlsByHeight.getForHeight(height: Int) = /* implementation goes here */
I was trying to make
getForWidth
not applicable to
UrlsByHeight
(and vice versa), but (1) and (2) are ‘conflicting overloads’ since their receiver have the same type.