Created
November 16, 2015 22:55
-
-
Save tucnak/0662193e8a203ead13ec to your computer and use it in GitHub Desktop.
Signal-slot concept in an imaginary Upd programming language
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
package stuff | |
import { | |
"fmt" | |
"github.com/tucnak/pipes" // пасхалка | |
} | |
class A { | |
slots: | |
Do() { | |
emit Done() | |
} | |
signals: | |
Done() | |
} | |
class B { | |
slots: | |
Log() { | |
fmt.Println("Hello, world!") | |
} | |
} | |
fn main() { | |
a := A{} | |
b := B{} | |
connect(a.Done, b.Log) | |
a.Do() // "Hello world!" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment