Nim: how can I make it closer to Python syntax? -
i know it's not idea want make nim more "pythonic". examples:
1) instead of proc, use def
2) instead of echo, use print
3) instead of readline, use input
4) instead of parsejson use json.loads
and on.
yes, may not possible change behavior of functions , statements, i'd - @ least - look "good old" python ones.
honestly, please don't explain me why think it's bad idea. want play , try it. no animals harmed, blah-blah.
any ideas?
thank you!
for echo, readline, , parsejson can definitions in system.nim , json.nim , define own procs. should work:
import json  proc print*(x: varargs[expr, `$`]) {.magic: "echo", tags: [writeioeffect], sideeffect.}  proc input*(f: file): taintedstring  {.tags: [readioeffect], benign.}  proc loads(p: var jsonparser): jsonnode = parsejson(p)   regarding def, don't think possible same syntax proc. if want to, can come def macro, generates ast of proc. far can see, resulting syntax defining proc pretty ugly. 
Comments
Post a Comment