I want to not only send those messages between threads, but also across the 
network. Anything containing additional pointers would just make things more 
complicated. Atm, I'm trying something like this (not entirely sure if 
toMsgBasePtr() is safe):
    
    
    type
      QueueID* = distinct uint16
      
      MsgBase* = object
        previous: ptr[MsgBase]
        sender*: QueueID
        receiver*: QueueID
      
      Msg*[T: not (ref|string|seq)] = object
        base*: MsgBase
        content*: T
    
    converter toMsgBasePtr(msgPtr: ptr Msg): ptr MsgBase {.inline, 
noSideEffect.} =
      cast[ptr MsgBase](msgPtr)
    

Reply via email to