Error using `bindSym` at compile time

2022-08-05 Thread deech
I get the use of `const` outside a static block but inside one in a language like Nim that doesn't have any stages above "compile time" it doesn't make any sense to me that it is different from `let`. My guess is the compiler isn't propagating that information when it supplies the argument to th

Error using `bindSym` at compile time

2022-08-05 Thread Vindaar
A bit offtopic, but this is the kind of explanation for these sort of features that would really help a lot to have written up in the manual.

Error using `bindSym` at compile time

2022-08-05 Thread Hlaaftana
Again, this is specific to `bindSym`. `bindSym` has to check the local context for symbols, and this context isn't available when "evaluating" constant expressions, only "compiling" them, so `bindSym` was originally made to use this context directly when "compiling" them. What `dynamicBindSym` d

Error using `bindSym` at compile time

2022-08-05 Thread Clonk
const is the Idiomatic way to declare compile time variable in Nim. let is used to declare immutable variable.

Error using `bindSym` at compile time

2022-08-05 Thread deech
Huh, I never thought to use `const` in a `static` block. What are the semantics of a compile time `const`?

Error using `bindSym` at compile time

2022-08-05 Thread deech
`dynamicBindSym` is interesting but in my case everything should be evaluating in the Nim VM at compile time. Why does `bindSym` not work in this case?

Error using `bindSym` at compile time

2022-08-05 Thread Hlaaftana
This is specific to `bindSym`. You need the experimental [dynamicBindSym](https://nim-lang.github.io/Nim/manual_experimental.html#dynamic-arguments-for-bindsym). I have a [PR open](https://github.com/nim-lang/Nim/pull/20125) which moves this to its own proc but it shouldn't be incompatible with

Error using `bindSym` at compile time

2022-08-05 Thread Clonk
The following with simply using const instead of let works : proc p(s:static[string]):NimNode {.compileTime.} = ... static: let t = "SomeType" echo p(t).repr Run

Error using `bindSym` at compile time

2022-08-05 Thread deech
I have a compile time proc `p` which I'd like to use in a `static` context: proc p (s:string):NimNode {.compileTime.} = bindSym(s) static: let t = "SomeType" echo p(t).repr Run but this errors with: Error: cannot evaluate at co

`mixin` ignores `when` branching

2022-08-05 Thread kobi
I am not sure, as I haven't tried this, but I think: you are importing tokens.nim in the first line of main.nim file. so, you have access to that proc. maybe you meant to include it? see that your concept of a mixin is the same concept in nim

Async musings

2022-08-05 Thread dom96
Nice, have you done any benchmarks yet? Really curious how it compares to stdlib async.

Mastering Nim: A complete guide to the programming language

2022-08-05 Thread planetis
I bought mine today, paying with the first money I've earned programming in Nim!

Threads dying, memory issues?

2022-08-05 Thread jasonfi
I'm using channels 1:1 right now, channels shared between threads sounds good though, unless there's a performance hit (will have to benchmark). If new channels don't fix the issue I'll work on a minimum program to reproduce the issue.

Threads dying, memory issues?

2022-08-05 Thread sekao
Yeah there's no documentation right now; I'm guessing the idea is to wait until ORC is the default in 2.0, but @Araq would know better. Anyway the API didn't change much. The one huge benefit is that they can be shared between threads; the old channels had to be declared as globals or manually