3 ms·
Nim actually already supports using `()` as braces most of the time for most constructs. So, in this sense it is more like Haskell than Python, though the latt
by cb321 1y ago
Nim actually already supports using `()` as braces most of the time for most constructs. So, in this sense it is more like Haskell than Python, though the latter is more well known.
Nim is also more "expressional" than Python in many ways. So, for example, in Nim you can say:
let x = (try: dict[key] except: 2)
for i in 1..x: (
echo i
)
Most users hate how that looks, though, much as most users of bracist languages also hate:
int foo(char bar) {
int c = 0;
for (char i = 0; i < bar; i++) c++;
return c; } // could be many '}' here
In reality, these discussions feel more like style guide wars, reformatted as PLang syntax wars, pun intended.
- Imustaskforhelp 1y agoWow tbh, I didn't know that you could do something like () in nim, I mean if somebody really really wants to use something similar to paranthesis, they sort of (could?) actually. Like, as to that person who thought Nim to be a deal breaker because of whitespace, I think that this new information might help them to atleast try Nim! Thanks, I learnt something new today thanks to ya!
- cb321 1y agoI actually noticed that other comment you mentioned and almost said something at that time. The style is just not mentioned much and Python is about 1000x more well known than other offside-rule PLangs like Haskell. There are also enough exceptions, in Nim at least, that a true bracy fan would have at least some disappointments here & there. In general Nim's syntax affords much, much more choice than Python, from UFCS to user-defined operators to macros to term re-writing macros to etc., etc. It's really a step up from Python in so many ways with a lot of compile-time checking and safety and essentially the same perf as C++. It's a shame it's not a little more popular.
- Imustaskforhelp 1y agoWell I actually really really appreicate nim and consider it to be a lovely language of sorts and want to build more in it just for hacking purposes/why not. I mean. sure they might be a bit disappointed but I didn't even know that () this syntax works, I mean {} is already used by something like set iiirc so something like it for nim might break existing functionality. I just really thought about how to convince others who might have the same grievances with nim because personally I don't mind whitespace but I also want nim to succeed of sorts. Nim to me is a love letter of sorts to programming in general. Maybe I romanticize nim but the only language I feel this sense of writing software in is maybe golang. I am forced to write typescript/python tho, yes I know that nim can be transpiled to js but still, I want to learn Nim too and just build some side casual projects like how people are building with zig. I don't want to suffer with memory management right now so I would use their garbage collection and then if someone wants performance, they can modify my software rather easily for that purpose too. I was thinking of creating a music player from scratch in nim just for learning it. idk, i really want to build something in nim / maybe even contribute to its small libraries to increase the library support