Stream: beginners

Topic: ✔ boolean logic keywords


view this post on Zulip antoni (Dec 14 2023 at 23:05):

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.

view this post on Zulip Luke Boswell (Dec 14 2023 at 23:14):

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.

view this post on Zulip Luke Boswell (Dec 14 2023 at 23:16):

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.

view this post on Zulip Luke Boswell (Dec 14 2023 at 23:17):

Apparently COBOL and ADA do

view this post on Zulip antoni (Dec 14 2023 at 23:17):

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)

view this post on Zulip Richard Feldman (Dec 14 2023 at 23:21):

Zig does it too

view this post on Zulip Richard Feldman (Dec 14 2023 at 23:22):

yeah I do like to set the bar fairly high for reserved keywords because it removes them from userspace

view this post on Zulip Richard Feldman (Dec 14 2023 at 23:23):

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:

view this post on Zulip Richard Feldman (Dec 14 2023 at 23:23):

and and or are both useful to have in userspace for query builders, for example

view this post on Zulip antoni (Dec 14 2023 at 23:44):

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:

view this post on Zulip Notification Bot (Dec 14 2023 at 23:59):

antoni has marked this topic as resolved.


Last updated: Jul 06 2025 at 12:14 UTC