Currently I improve the proceduer `computeSize` in `types.nim`. I worked now 
quite a bit on the procedure, but I don't understand, how `system.sizeof` 
eventually calls `types.computeSize`. I know that in some cases the call 
system.sizeof was not able to be evaluated at compile time. I would like to 
know how this decision is made.

Eventually I would like to add `system.alignof` analogue to `system.sizeof`. 
Then I would like to add offsetof, but here I do not know how the interface 
should look like. This is an idea:
    
    
    proc offsetof[T](typ: typedesc[T]; member: untyped): int
    

For my use case it is very important, that I can get all the sizes at compile 
time, therefore I would like to make all this also available with NimNode 
arguments:
    
    
    # macros.nim
    proc sizeof(typ: NimNode)
    proc alignof(typ: NimNode)
    proc offsetof(member: NimNode)
    

But here again, I don't understand how I can bind these procedures to the 
functions I defined in `types.nim`.

Reply via email to