!bClXsReyeEQZkxlUjI:matrix.org

Gavin's Programming

426 Members
13 Servers

Load older messages


SenderMessageTime
20 Dec 2023
@_discord_679283565996933142:t2bot.ioRaph
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
@_discord_679283565996933142:t2bot.ioRaph *
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
@_discord_515313851693137921:t2bot.iogalacticcolourisation yep, awful 20:56:03
@_discord_679283565996933142:t2bot.ioRaph 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
@_discord_679283565996933142:t2bot.ioRaph it's essentially just different syntax for this
for a pattern match
20:57:37
@_discord_515313851693137921:t2bot.iogalacticcolourisation computations that may fail need their own type 20:58:09
@_discord_679283565996933142:t2bot.ioRaph if the compiler just assumes the last multiple return value is a type what's the difference? 20:58:34
@_discord_679283565996933142:t2bot.ioRaph yeah that sentence didn't make much sense to me 21:00:30
@_discord_679283565996933142:t2bot.ioRaph if you know the idiom and the compiler is aware of it 21:00:38
@_discord_679283565996933142:t2bot.ioRaph to me it seems like the same thing 21:00:43
@_discord_679283565996933142:t2bot.ioRaph maybe slightly more annoying 21:00:56
@_discord_679283565996933142:t2bot.ioRaph cause each type has its own zero value 21:01:02
@_discord_679283565996933142:t2bot.ioRaph but yeah this language has some hot takes 21:01:23
@_discord_679283565996933142:t2bot.ioRaph I wanna try using it just to get a feel 21:01:28
@_discord_679283565996933142:t2bot.ioRaph brb gotta catch the bus 21:02:12
@_discord_679283565996933142:t2bot.ioRaph back 21:36:24
@_discord_515313851693137921:t2bot.iogalacticcolourisation welcome back my man 21:45:04
@_discord_679283565996933142:t2bot.ioRaph thx 21:45:21
@_discord_679283565996933142:t2bot.ioRaph so back to hating odin ig 21:45:32
@_discord_679283565996933142:t2bot.ioRaph 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
@_discord_679283565996933142:t2bot.ioRaph this is still a step above C 21:46:05
@_discord_679283565996933142:t2bot.ioRaph I tried binding to ncurses yesterday I think? it was pretty low effort (not as great as zig's but still) 21:46:40
@_discord_515313851693137921:t2bot.iogalacticcolourisation i dont really care 21:46:43
@_discord_679283565996933142:t2bot.ioRaph I'm just exploring my guy lol 21:46:56
@_discord_679283565996933142:t2bot.ioRaph I know you're on the FP coolaid 21:47:01
@_discord_515313851693137921:t2bot.iogalacticcolourisation nah i mean i don't really care about odin 21:47:06
@_discord_515313851693137921:t2bot.iogalacticcolourisation not that i hate it 21:47:09
@_discord_679283565996933142:t2bot.ioRaph oh 21:47:15
@_discord_515313851693137921:t2bot.iogalacticcolourisation but it's just tiring 21:47:16
@_discord_679283565996933142:t2bot.ioRaph what is? 21:47:20

Show newer messages


Back to Room ListRoom Version: 6