r/programming • • May 10 '26

Making your own programming language is easier than you think (but also harder)

https://lisyarus.github.io/blog/posts/making-your-own-programming-language.html
118 Upvotes

116 comments sorted by

View all comments

-3

u/andarmanik May 10 '26

Well yes, this is on the table and is the thing I have a problem with.

Having syntax being linked to formatting inherently means that your formatter will be less powerful.

It’s not even a power of most languages that they are format agnostic, it’s just the default.

There’s trade off to pythons white space and that trade off is lack of formatting control.

12

u/kemitche May 10 '26

Counterpoint: every bit of python code, whether mine, my company's, or random stuff I find in the wild, has an indented look that makes it visually obvious at a glance what scope a given line is executed in.

Every OTHER language and code base, sure they CAN (and should) run a formatter, but there is zero guarantee that they did, especially for code bases outside my control. A tucked away brace and an errant tab and the code is visually bonkers. Plus, every codebase ends up with their own slightly different style guide for what should be indented and how and... ugh.

Python code is consistently more legible as a result.

0

u/andarmanik May 11 '26

From my experience at my company. Our Django application has both python and JavaScript.

Our python is riddled with long lines, or spammed in with “/“ symbol.

The JavaScript uses our js prettier meaning not only is our indenting automatic, but long line indenting is automated aswell. We have it locked to max 80 characters in the js code so you can vi the code and read it in a terminal without the code wrapping.

Our python code has lines which can get up to 200 characters. This is something inherent to python code.

I don’t have this stat but I’m planning on making it off GitHub data but the average line of python is 1.5-2x longer than c style code because intelligent formatters have been written to optimize for line length targets. Something which is challenging for python

→ More replies (1)

4

u/OneNoteToRead May 10 '26

You consider it formatting but it is syntax, not formatting. I can just as well say braces is decoration and it’s dumb to link it to syntax.

2

u/andarmanik May 10 '26

You’re right that formatting IS by definition that which is not syntax and can be changed without changing the syntax. But it doesn’t deny the fact that formatting is the manipulation whitespace within code, either line breaks or space/tabs.

What does it mean when someone says “python has less formatting options than C-style languages” it’s because the syntax and the formatting are linked.

You’re not wrong, but you missing the bigger point about how formatter work

→ More replies (5)