Araq, replied in the IRC channel. It is
PType(idTableGet(x.bindings, x.callee.sons[0]))
I keep them updated in
[https://github.com/def-/nim-unsorted](https://github.com/def-/nim-unsorted)
but I'm too lazy to update all of those Rosetta Code entries manually.
I need advice from the Nim compiler ninja.
I am inside semResolvedCall(semcall.nim) function and I have instance of
TCandidate object which has **bindings** field. It is a table from generic
param types to concrete param types. How do I extract a **concreate return
type**? I don't need
Make the macro generate a `when` statement that accesses the const instead of
trying to access the not yet existing const.
to be fair, I feel that (in general) the critical approach to OOP that people
tend to have nowadays is refreshing. c.f., Stroustrup's [OOP without
inheritance](https://www.youtube.com/watch?v=xcpSLRpOMJM)
IMO, what most people need from OOP is dot notation I really like Nim's
uniform function
Congratulations, this is a big milestone in nim's life.
you might also try something like this
import macros
#const CX = "8"
const CX = "7"
macro process_const_str(s: static[string]): typed =
result = newNimNode(nnkStmtList)
if s[0] == '7':
for i in 0..<3:
result.add newCall("echo",
And splitting the macro does not help:
import macros
const CX = 7
proc genVar(c: string): NimNode {.compiletime.} =
result = newNimNode(nnkStmtList)
var
section = newNimNode(nnkVarSection)
constDef = newNimNode(nnkIdentDefs)
No, can not access the const with constructed name inside the macro
import macros
const CX = 7
proc genVar(c: static[string]): NimNode {.compiletime.} =
result = newNimNode(nnkStmtList)
var
section = newNimNode(nnkVarSection)
constDef =
Hi
I have programmed in a few languages extensively in my life, though now I
primarly use Ruby.
I just found out about Nim literlly 3 weeks ago now (mid July 2017) after
reading this article: **Nim for the discerning Rubyist**
10 matches
Mail list logo