zlacker

[parent] [thread] 2 comments
1. xigoi+(OP)[view] [source] 2025-12-05 15:36:30
Nim (the original one, not Nimony) compiles to C, so making basic types work differently from C would involve major performance costs.
replies(2): >>umanwi+E2 >>ratmic+14
2. umanwi+E2[view] [source] 2025-12-05 15:47:00
>>xigoi+(OP)
> making basic types work differently from C would involve major performance costs.

Not if you compile with optimizations on. This C code:

  int wrapping_add_ints(int x, int y) {
      return (int)((unsigned)x + (unsigned)y);
  }
Compiles to this x86-64 assembly (with clang -O2):

  wrapping_add_ints:
          lea     eax, [rdi + rsi]
          ret
Which, for those who aren't familiar with x86 assembly, is just the normal instruction for adding two numbers with wrapping semantics.
3. ratmic+14[view] [source] 2025-12-05 15:52:34
>>xigoi+(OP)
Presumably unsigned want to return errors too?

Edit: I guess they could get rid of a few numbers... Anyhow it isn't a philosophy that is going to get me to consider nimony for anything.

[go to top]