Skip to content

Instantly share code, notes, and snippets.

View enthus1ast's full-sized avatar

David Krause enthus1ast

View GitHub Profile
import asyncdispatch, asyncnet
type
Server = ref object
socket: AsyncSocket
proc newServer(): Server =
Server(socket: newAsyncSocket())
proc loop(server: Server, port = 7920) {.async.} =
server.socket.bindAddr(Port(port), "0.0.0.0")
import distros
for dist in Distribution:
echo dist, detectOs(dist)
distrost.nim(53, 22) template/generic instantiation of `detectOs` from here
distros.nim(184, 28) Error: undeclared field: 'dist'
found 'dist' of kind 'forvar'
import distros
import macros
macro whichOs(): untyped =
result = newStmtList()
for dist in Distribution:
result.add newCall("echo", newLit dist , newLit " ", newCall("detectOs", newIdentNode($dist)))
whichOs()
dumpTree:
var dis: set[Distribution] = {}
if detectOs(Windows):
dis.incl Windows
## more detect os