Last active
January 2, 2016 02:59
-
-
Save hughfdjackson/8240674 to your computer and use it in GitHub Desktop.
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
| // direct definition | |
| def printPerson(person: { name: String }): Unit = { | |
| println (person.name) | |
| } | |
| printPerson({ name: 'foo' }) // prints 'foo' | |
| // with a structural alias | |
| type Person = { | |
| name: String | |
| } | |
| def printPerson(person: Person): Unit = { | |
| println (person.name) | |
| } | |
| printPerson({ name: 'foo' }) // prints 'foo' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment