Re: Inspecting Object Field Pragmas

2018-02-11 Thread StasB
I understand that. I just don't understand why calling getTypeImpl on a type gives you a different tree from the one that getImpl on a symbol returns. I would've thought that the latter would simply delegate the job to the former when the symbol is associated with a type. Is there some semantic

Re: How to embed a header file into a .nim file

2018-02-11 Thread DTxplorer
I solved this by using "\--passL" instead of "\--passC "

Re: Inspecting Object Field Pragmas

2018-02-11 Thread cdome
In your example t is not a symbol, it is a type. These are two difference concepts. There is relation between the two, but not 1-to-1.

Re: Concerned about this bug

2018-02-11 Thread twetzel59
Wow, fixed already! You're so helpful, that's great!

Re: Inspecting Object Field Pragmas

2018-02-11 Thread StasB
I see. My initial attempt looked something like this: proc test(t: typedesc) {.compileTime.} = echo t.getTypeImpl.treeRepr static: test(MyObj) This did give me field names and types, but no pragmas. It seems like the pragma information isn't attached d

Re: Inspecting Object Field Pragmas

2018-02-11 Thread cdome
You need to use latest Nim dev version to compile my example. You got it almost correct. Nim has a notion of Symbol. Symbols (procs, typedefs, variables and etc) have many attributes like scope, type and others. Most importantly, symbols have implementations that you can access using getImpl pr

Module logging: how to create the right Logger(s) in a library?

2018-02-11 Thread monster
I've just had my first look at the logging module. The "Warning" immediatly caught my eye: "The global list of handlers is a thread var, this means that the handlers must be re-added in each thread." If I'm writing a "library" meant to be used by others (eventually), that create it's own thread

Re: Concerned about this bug

2018-02-11 Thread twetzel59
Ok, thank you!

What is the content/format of nativesockets.Hostent.addrList?

2018-02-11 Thread monster
I'm trying to write a (very) primitive "service discovery" module, and it seems "nativesockets.Hostent.addrList" is not what I would have expected. Here the code I used: import nativesockets import net import strutils proc parseURL(hostport: string): tuple[ip: strin

Re: Inspecting Object Field Pragmas

2018-02-11 Thread StasB
I'm not sure I understand. So NimNodes of the nnkSym kind contain NimSyms that can be extracted with the symbol proc, and the NimSyms contain more NimNodes? Your example doesn't seem to compile.

Re: Inspecting Object Field Pragmas

2018-02-11 Thread cdome
Feature is relatively new, here is an example import macros template mykey(s: string{lit}) {.pragma.} type MyObj = object a1 {.mykey("a").} : int macro my(t: typedesc): untyped = echo t.getTypeInst[1].symbol.getImpl.treeRepr my(M

Inspecting Object Field Pragmas

2018-02-11 Thread StasB
Hi! I've noticed that it's possible to annotate the fields of an object type with custom pragmas, and that the treeRepr output for the type statement will reflects it. However, the structure returned by getTypeImpl etc. doesn't seem to contain anything about pragmas, custom or otherwise. Is ther

Re: Concerned about this bug

2018-02-11 Thread Araq
I bet a million lines of Nim code was written before this bug was detected, don't worry.