|
|
|
|
|
by DeIlliad
925 days ago
|
|
I want to get into Nim but I think the language is way too verbose for my taste. It's so similar to spoken English, even compared to Python, that it enters some sort of uncanny valley which makes reading Nim code give me a headache. |
|
EDIT: For example, say you want Python's Walrus operator. You can just do this (although you can often just use a slightly more verbose parenthesized `let` expression):
or maybe you want `myvar |= flag` like in C/Python. You can also do that: But both of those could also be templates or macros that get the whole AST, can pick the AST apart, and emit whatever Nim code you actually want.In fact, since Nim has nicely nested scopes & hygienic templates, you can define a bunch of operators in a library `template`, called say `unsafePtrArith` for pointer arithmetic, import that and then make them available in a little sub-scope to your code like:
or