Stream: contributing

Topic: kebab-case or snake_case for roc app filenames


view this post on Zulip Sam Mohr (Jan 31 2025 at 17:19):

Do we have a common naming scheme for Roc app filenames? In the recent camelCase cleanUp PR from @JanCVanB he renamed camelCase apps to snake_case, e.g. roc_loves_zig. I feel like I've seen more kebab-case for script file names on Roc. I don't think it's good to enforce anything about file naming, but we should probably agree on and document a convention. I'd vote kebab-case given the choice.

view this post on Zulip Anton (Jan 31 2025 at 17:26):

Yes, kebab is the convention

view this post on Zulip Anton (Jan 31 2025 at 17:26):

#compiler development (private) > app name convention @ 💬

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:27):

That thread is private lol

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:28):

Okay, then until this discussion leans away from kebab-case, could you update your PR to use kebab-case @JanCVanB

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:28):

When you get the chance

view this post on Zulip jan kili (Jan 31 2025 at 17:28):

It seems that thread decided kebab>camel, but I do propose snake for consistency.

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:29):

You're gonna make me propose we use kebab-case for variables, aren't you?

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:29):

Well, if you twist my arm...

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:29):

Anyway

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:30):

The benefit of camel-case is that I think it's the closest to English-reading of the cases, and it works well for SEO

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:30):

But I agree that Roc currently has exactly two cases in the language: PascalCase and snake_case

view this post on Zulip jan kili (Jan 31 2025 at 17:31):

apps expose snake_case defs, and Modules expose PascalCase and snake_case defs. Module file naming convention is PascalCase, so it seems app should be snake_case

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:32):

You make a compelling argument

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:35):

Can someone give me perms to read that thread? If you'd rather not, that's fine

view this post on Zulip jan kili (Jan 31 2025 at 17:36):

12e6868b-a67d-4e1e-b1cf-30e9244865c6.png

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:37):

So I'm definitely onboard with consistency trumping other factors, so we should use snake_case if that's what we use for variables.

view this post on Zulip jan kili (Jan 31 2025 at 17:39):

A smaller motivation is that in many unrelated ecosystems I see kebab-case for directory names and anything else for file names.

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:41):

And because of that, you think that having either PascalCase or snake_case for file and folder names would give Roc projects a cleaner file structure?

view this post on Zulip Sam Mohr (Jan 31 2025 at 17:42):

Also, the argument from @Brendan Hansknecht in that thread is that some filesystems like OSX don't care about casing, which means camelCase can be a footgun. kebab-case or snake_case should work equally well, including in URLs

view this post on Zulip jan kili (Jan 31 2025 at 17:47):

Sam Mohr said:

either PascalCase or snake_case for file and folder names

:point_up:
In general I like kebab-case for folders, but idk what to think about dir naming conventions in Roc - in our Rust platforms we seem to like snake_case dirs. I have no opinion/proposal for dirs right now.

view this post on Zulip jan kili (Jan 31 2025 at 17:48):

Also, if we want to intentionally have no convention, I'm happy to mix it up like roc_loves_rust.roc + roc-loves-zig.roc

view this post on Zulip Richard Feldman (Jan 31 2025 at 17:49):

I think snake case makes more sense now

view this post on Zulip Richard Feldman (Jan 31 2025 at 17:51):

previously we only used camelCase in source files, so using snake_case could have been confusing as to what the convention was - whereas kebab-case would be subtraction in source files, so no confusion

view this post on Zulip Richard Feldman (Jan 31 2025 at 17:51):

but now that we have snake_case in source files, it makes intuitive sense to me to keep that convention for filenames

view this post on Zulip Richard Feldman (Jan 31 2025 at 17:52):

it's really annoying to me that in Rust some crate names are snake_case and some are kebab-case

view this post on Zulip Richard Feldman (Jan 31 2025 at 17:52):

let's just never use kebab and have it never be confusing :big_smile:

view this post on Zulip Brendan Hansknecht (Feb 01 2025 at 02:32):

Another related annoyance with kebab. A lot of systems do kebab for file names or package names, yet as imports they are snake case. It is really annoying. Super minor, but really annoying.

view this post on Zulip Brendan Hansknecht (Feb 01 2025 at 02:33):

So whatever we do, I think it is nicest to do it in a very clear way.

view this post on Zulip Brendan Hansknecht (Feb 01 2025 at 02:36):

So I would probably vote PascalCase for all files, folders, and package names (cause that matches modules and imports). Maybe with a special exception for applications.


Last updated: Jul 06 2025 at 12:14 UTC