Re: Compiler internals question: TIdTable tables

2017-08-07 Thread cdome
Araq, replied in the IRC channel. It is PType(idTableGet(x.bindings, x.callee.sons[0]))

Re: These Rosetta Code examples don't compile with 0.17.0

2017-08-07 Thread def
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.

Compiler internals question: TIdTable tables

2017-08-07 Thread cdome
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

Re: Identifier constructon in macro -- no success

2017-08-07 Thread Araq
Make the macro generate a `when` statement that accesses the const instead of trying to access the not yet existing const.

Re: What can Nim learn from Crystal

2017-08-07 Thread evacchi
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

Re: Nim in Action is finally here

2017-08-07 Thread Arrrrrrrrr
Congratulations, this is a big milestone in nim's life.

Re: Identifier constructon in macro -- no success

2017-08-07 Thread Parashurama
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",

Re: Identifier constructon in macro -- no success

2017-08-07 Thread Stefan_Salewski
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)

Re: Identifier constructon in macro -- no success

2017-08-07 Thread Stefan_Salewski
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 =

Nim newbie request/challenge

2017-08-07 Thread jzakiya
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**