"fall-through" and default values

2024-05-22 Thread giuliano
Thanks for the reply, guys. I think the part that confused me is that `proc aProc(): T` will happily return `default(T)` in case the return value is undefined by the end of its execution, as in, for instance: proc aProc*(): auto = if false: return 1 # returns

"fall-through" and default values

2024-05-22 Thread giuliano
I've bumped into the following subtlety and was wondering if anyone could help me clarify it. Why does the following fails to compile: proc aProc*(): int = try: 1 except Exception as exc: echo "oops" # Fails with "Error: expression '1' is of type

sink parameters not being copied even when there are later reads (refc)

2024-02-26 Thread giuliano
Thanks @Araq, I'll open an issue then.

sink parameters not being copied even when there are later reads (refc)

2024-02-23 Thread giuliano
Hey, thanks @gabbhack. That is consistent with what I'm observing, and since sink parameters can be mutated, I end up getting something akin to a var when the object is big and a "mutable copy" when it's not.

Funny sink behavior with refc

2024-02-23 Thread giuliano
Hello there, In tracking a bug in our codebase I have bumped into some funny behavior with sinks while using `refc` (nim 1.16.18 and 2.0.2 on Linux), and was wondering if I am missing anything silly. This example captures the issue: type AnObject* = object of RootObj value*:

sink parameters not being copied even when there are later reads (refc)

2024-02-23 Thread giuliano
Hello there, In tracking a bug in our codebase I have bumped into some funny behavior with sink parameters while using refc (nim 1.16.18 and 2.0.2 on Linux), and was wondering if I am missing anything silly. This example captures the issue: type AnObject* = object of RootObj

Can't trace the origin of "unlisted exception: Exception" when building a callback table

2023-12-08 Thread giuliano
That worked, thanks a lot @Araq!

Can't trace the origin of "unlisted exception: Exception" when building a callback table

2023-12-08 Thread giuliano
Hello folks, I apologize in advance if this is a silly question as I'm new to nim, but I'm bumping my head against this to no avail for a bit, so here it goes. I have the following snippet: import std/tables type CallbackRegistry = object table: Table[string,