Created
February 22, 2018 00:42
-
-
Save kateinoigakukun/92fc9f5fd9a866032cd01a9ff11ae671 to your computer and use it in GitHub Desktop.
こういうのを求めてる #CodePiece
This file contains 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
protocol Nouns {} | |
protocol Verb {} | |
struct I: Nouns {} | |
struct Play: Verb, Nouns {} | |
struct Tennis: Nouns {} | |
struct Love: Verb {} | |
struct SVO<S: Nouns, V: Verb, O: Nouns> { | |
init(s: S, v: V, o: O) {} | |
} | |
let phrase1 = SVO(s: I(), v: Play(), o: Tennis()) | |
let phrase2 = SVO(s: I(), v: Love(), o: Tennis()) | |
let phrase3 = SVO(s: Play(), v: I(), o: Love()) // compile error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment