You don't need to exportc/emit. You can use let + unsafeAddr:

  * [declaration of a LUT 
table](https://github.com/numforge/laser/blob/2f619fdb/laser/primitives/simd_math/exp_log_common.nim#L46)
  * 
[Usage](https://github.com/numforge/laser/blob/2f619fdb/laser/primitives/simd_math/exp_log_fallback.nim#L40)



That said I would like an `{.addressable.}` pragma for const because using 
`let` creates issue with `{.noSideEffect.}` inference (but you can now have 
`{.noSideEffect.}` blocks so not that urgent as well for internal adressable 
const).

Beyond my LUT table example, this would be useful for cryptography where you 
want to do modular operations vs a particular prime but instead of always 
inlining against that array, you want the prime to be stored only once in the 
BSS for code-size reason and more importantly you want that modulo prime to be 
part of the proc types (though that would need 
[https://github.com/nim-lang/Nim/issues/11142](https://github.com/nim-lang/Nim/issues/11142)
 to be fixed first).

Var/let cannot help here as you need a const to be able to pass it as a static 
param, unless I use something like `let myPrime {.compileTime.} = 
parseHex("0x1234567890ABCDEF")` and unsafeAddr thanks to 
[https://github.com/nim-lang/Nim/pull/12128](https://github.com/nim-lang/Nim/pull/12128)
 which allow runtime access to compileTime let.

Btw this can help your own issue, not sure if that was intended though, should 
we make const an alias to compile-time let?

Reply via email to