-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting top level so I can move to global and namespaces
- Loading branch information
1 parent
4dd20cf
commit cddaf91
Showing
8 changed files
with
189 additions
and
87 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
enum Action { | ||
run { speed }, | ||
stop, | ||
} | ||
|
||
fn main() { | ||
let action = Action.run { speed: 5 } | ||
|
||
if action.speed >= 3 { | ||
println("Fast") | ||
} | ||
println(action) | ||
println(action.speed) | ||
|
||
// TOOD: How do I represent this? | ||
// It is a property access. So I need Action to exist | ||
// in the scope. What is action? I guess it is type enum? | ||
// If I print Action itself, what does it return? | ||
// I need a "global" (or really namespace) environment for this. | ||
// let stop = Action.stop | ||
|
||
// println(stop) | ||
|
||
"done" | ||
} | ||
|
||
// Expect | ||
// Fast | ||
// Action.run { speed: 5 } | ||
// 5 | ||
// done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
let x = 2 | ||
|
||
println(x) | ||
|
||
fn main() { | ||
println("Hello, world!") | ||
// TODO: this prints function... | ||
// println(x) | ||
"done" | ||
} | ||
|
||
// Expect | ||
// 2 | ||
// Hello, world! | ||
// done |
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
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
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
Oops, something went wrong.