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
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.
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
const is the Idiomatic way to declare compile time variable in Nim.
let is used to declare immutable variable.
Huh, I never thought to use `const` in a `static` block. What are the semantics
of a compile time `const`?
`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?
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
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
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
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
Nice, have you done any benchmarks yet? Really curious how it compares to
stdlib async.
I bought mine today, paying with the first money I've earned programming in Nim!
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.
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
14 matches
Mail list logo