This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dumpTree: | |
var dis: set[Distribution] = {} | |
if detectOs(Windows): | |
dis.incl Windows | |
## more detect os |
OlderNewer