20 Dec 2023 |
Raph | get_error :: proc() -> (int, bool) {
return 0, false
}
main :: proc() {
v, err := get_error()
if err != false {
return false
}
// or
v := get_error() or_return
} | 20:55:28 |
Raph | * get_error :: proc() -> (int, bool) {
return 0, false
}
main :: proc() {
// a la golang
v, err := get_error()
if err != false {
return false
}
// idiomatic version
v := get_error() or_return
} | 20:55:40 |
galacticcolourisation | yep, awful | 20:56:03 |
Raph | also
get_error :: proc() -> (int, bool) {
return 0, false
}
main :: proc() {
// a la golang
v, err := get_error()
if err != false {
v = 0
}
// idiomatic version
v := get_error() or_else 0
} | 20:56:12 |
Raph | it's essentially just different syntax for this for a pattern match | 20:57:37 |
galacticcolourisation | computations that may fail need their own type | 20:58:09 |
Raph | if the compiler just assumes the last multiple return value is a type what's the difference? | 20:58:34 |
Raph | yeah that sentence didn't make much sense to me | 21:00:30 |
Raph | if you know the idiom and the compiler is aware of it | 21:00:38 |
Raph | to me it seems like the same thing | 21:00:43 |
Raph | maybe slightly more annoying | 21:00:56 |
Raph | cause each type has its own zero value | 21:01:02 |
Raph | but yeah this language has some hot takes | 21:01:23 |
Raph | I wanna try using it just to get a feel | 21:01:28 |
Raph | brb gotta catch the bus | 21:02:12 |
Raph | back | 21:36:24 |
galacticcolourisation | welcome back my man | 21:45:04 |
Raph | thx | 21:45:21 |
Raph | so back to hating odin ig | 21:45:32 |
Raph | I think that if you care for types but not to the extent of having Rust/Haskell levels of type checking/guarantees | 21:45:58 |
Raph | this is still a step above C | 21:46:05 |
Raph | I tried binding to ncurses yesterday I think? it was pretty low effort (not as great as zig's but still) | 21:46:40 |
galacticcolourisation | i dont really care | 21:46:43 |
Raph | I'm just exploring my guy lol | 21:46:56 |
Raph | I know you're on the FP coolaid | 21:47:01 |
galacticcolourisation | nah i mean i don't really care about odin | 21:47:06 |
galacticcolourisation | not that i hate it | 21:47:09 |
Raph | oh | 21:47:15 |
galacticcolourisation | but it's just tiring | 21:47:16 |
Raph | what is? | 21:47:20 |