Created
July 30, 2019 11:46
-
-
Save ch8n/5346af48f457495c538f89f5772b8dd1 to your computer and use it in GitHub Desktop.
refactoring Error Destrcurting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Gotcha #5 refactoring issue/ no compileTimeCheck | |
data class ContactMe(val email: String, val phone: String, val twitter: String) | |
val contact = ContactMe("[email protected]","999999999","ch8n2@twitter") | |
//destructing | |
val (email,phone,twitter) = contact | |
data class ContactMe(val email: String, val phone: String, val medium:String,val twitter: String) | |
val contact = ContactMe("[email protected]","999999999","ch8n@medium","ch8n2@twitter") | |
//destructing | |
val (email,phone,twitter) = contact // it will compile but twitter with have value "ch8n@medium" | |
//this behavious is again the cause of positional destructing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment