I know it's generally NOT a good idea but I want to 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 so on.
Yes, it may not be possible to change the behavior of the functions and statements, but I'd like it to - at least - look like the "good old" Python ones.
Honestly, please don't explain me why you think it's a bad idea. I want to play and try it. No animals would be harmed, blah-blah.
Any ideas?
Thank you!
For
echo
,readLine
, andparseJson
you can look up their definitions in system.nim and json.nim and define your own procs. This should work:Regarding
def
, I don't think it is possible with exactly the same syntax as forproc
. If you want to, you can come up with somedef
macro, which itself generates the AST of some proc. But as far as I can see, the resulting syntax for defining a proc would be pretty ugly.