Araq / ormin

Ormin -- An ORM for Nim.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

type expected, but got: nil

kidandcat opened this issue · comments

import ormin / [serverws]
import ormin

import json

importModel(DbBackend.sqlite, "chat_model")

#var db {.global.} = open("chat_ormin.db", "", "", "")

protocol "pingclient.nim":
  server "ping":
    echo "got ping"
    send(%1)

  client "ping":
    proc ping*() {.exportc.}
    var res: int
    res = recv()
    echo "got " & $res

serve "ormin", dispatch

In the chat example you don't specify the type to recv()

PD: it works if I use recv(int)

Is that a documentation/example bug?

I suppose yes, but if you tell me it should work without the typing.... I'm not sure if recv() can infer the type from the variable you are assigning to.

If it's a doc bug, I'll fix it by PR.

Hmm, I don't remember Ormin's code base. :D Stay tuned.

So ... forumproto.nim contains this code:

  client:
    type Session = ref object
    var gSessions: seq[Session]
    gSessions = recv()
    proc getAllSessions()

And to the best of my knowledge this test is green. recv() here uses the seq[ of the previously type as defined in the type section ].