I noticed that roc uses a lot of keywords as syntax tokens like with when ... is
(which I really like and think makes sense) but what surprised me was that with boolean logic like if something && somethingElse then
it uses symbols.
Is there a reason for this, or was this discussed before? I feel like something akin to python would feel much more intuitive to me.
I'm not sure if it has been discussed much in this context, but I'm pretty sure the idea is to have as few keywords as possible. This is so these words can be used as identifiers I guess.
I guess using symbols for those operators may be more familiar to people coming from popular languages. I'm not familiar with any languages that use and
not
or
for boolean operations.
Apparently COBOL and ADA do
python does it and seems pretty popular :big_smile:
I get the idea with as few keywords as possible, I just can't really imagine a scenario other than booleans where one would like to have identifiers with those names (as they aren't really descriptive)
Zig does it too
yeah I do like to set the bar fairly high for reserved keywords because it removes them from userspace
like it's been annoying to me many times in my career when type
is a reserved keyword, and I've made sure it's not in Roc :big_smile:
and
and or
are both useful to have in userspace for query builders, for example
Ah, yeah that makes sense. Still seems a bit strange to have such symbols in between other syntax to me but since it's coming from a practical point of view I'll probably appreciate it in the future :grinning_face_with_smiling_eyes:
antoni has marked this topic as resolved.
Last updated: Jul 06 2025 at 12:14 UTC