General philosophy around why snake case? #4702
Replies: 1 comment 1 reply
-
It's the convention the BEAM ecosystem has always used, and Gleam is a good citizen of the ecosystem. With Gleam's JSON and decoder there is no coupling between the case of the frontend and the backend. It's for example common to have
This seems like it would be useful, but in practice it's largely not. There's not much code that can be practically shared between frontend and backend unless you are sharing HTML-rendering view code, which you've said you're not.
You could use snake case in JavaScript if you want. It's valid syntax and while not the more widely used case it's not uncommon. Python+Django itself uses both snake and camel. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Firstly gleam looks like a really exciting project that solves most of the pain points of web development, brilliant!
Gleam seems to have a focus/slant (at least initially) towards web dev. As a current Django developer, one of my biggest pain points is snake_case (on the backend) and camelCase on the front end. Even though I use an automatic converter middleware, theres always mistakes in docs, testing, and corner cases associated with this seemingly small and simple detail. Although I personally prefer snake_case, the case choice of Python and JS have sailed. Anyone know why gleam chose snake case after camelCase dominance in the web world had been established? In fact it even goes one step further to forbid camelCase, so I am not sure how destructuring FE responses that have camelcase would go?
Any thoughts around that?
Being able to share the same Typescript interfaces on the front and backend would be absolutely wonderful, however this feels like an issue I can't reconcile. PS: Although Lustre and other FE frameworks are great, I use native web components.
Beta Was this translation helpful? Give feedback.
All reactions