Spyke
davereply
feddit.uk

But you get the joke faster now.

18

No, it's just impossible for it to leak out of a hole in the back of your head that you didn't realise was growing under your pony tail.

8

To me it just looks like you do not need the braces at all

14

A funny, but incredibly subtle joke to do would be to do a post like this, but get the indentation subtly wrong somewhere, so something that's supposed to be inside a loop is outside according to indentation, but is inside according to braces.

5
Logireply
lemmy.world

Same. Until you notice the column of curly braces and semi colons in the right margin.

165
zlatkoreply
programming.dev

You never review code when you have no time to do an actual review? Looks good to me :)

13
lemmy.dbzer0.com

You never review code when you have no time to do an actual review?

Nope. Then again, I never review code at all 🤷😁

5

Don’t review, don’t write tests, and don’t even do QA. All of those tasks are overhead. It’s time you could be spending completing more story points. All that matters is story points, not the customer, not your coworkers, not your happiness, not your sanity. Just story points.

8

No, Rust lacks the semicolon elision rules of Javascript which make everyone always use semicolons in javascript because they're so horribly broken.

Rust is like ML, quite literally, not just by ancestry: The syntax is palpably ugly, but at least it's sane, regular, and concise where it matters.

7

Undervalued comment right there. This is better than the OP

2
aussie.zone

rustfmt

is stopping me from writing code like this, and I have never been more happier using it after viewing this.

71
lemmy.world

I'm going to write a tool that automatically adds the braces and semicolons to the column as you edit the code.

I will call it rustfml

60
verstrareply
programming.dev

It could be run after git checkout and then rustfmt before commit.

10
feddit.uk

I hate it with every fibre of my being but also secretly calmed by that column of statement terminators and brackets.

It's like the code representation of the Vancouver riots kiss photo.

29
Lenareply
gregtech.eu

Why would that cause the same feeling?

1
feddit.uk

I'm not sure if you're taking the piss or not but I'm going to choose to believe you're asking in good faith!

The code just feels... messy, unfamiliar, almost chaotic - but the semicolons and curly brackets in a neat little row, formatted in a satisfying way, is like an island of calm and order in the middle of a formatting clusterfuck.

A moment of serenity in the middle of a riot, one may think.

3

Ohhhh thanks for the explanation, I'm a bit stupid :3

Also, I didn't mean it in a bad way, a genuine question. Thanks for assuming it's in good faith ^^

3
lemm.ee

This makes my deeply uncomfortable, like an itch I can't quite scratch.

17

DwangoAC and the TASBot crew are maniacs in the best possible way. I would like to continue having a high opinion of him, hence I will pretend that this post does not exist.

12
lemmy.sdf.org

Wow, so this is possible.

Formatting is so damn arbitrary. Somebody has to have tried storing just the parse tree on disk, right?

11
pawb.social

If you do that, you lose formatting and comments every time you load the source from disk

2
CanadaPlusreply
lemmy.sdf.org

Losing formatting other than what you've set in your deparser would be the point. Losing comments would be bad, but that seems easily fixable just by giving each comment block a symbol that points to it's contents.

3
djehutireply
programming.dev

Or by including comments in the parse tree. (& Yes, it is done various places for various languages and formats.)

3
CanadaPlusreply
lemmy.sdf.org

Do you have some examples?

(That is what I meant by giving them a symbol, maybe I worded it poorly)

1

The best example I have is a closed source one and I can't be more specific on what it is than to say that it's probably installed on at least one of your Apple devices (assuming you have any).

Implementation-wise, the syntax tree nodes have additional attributes that hold pre- and/or post-element text. What's on disk is the serialized tree. You edit a text version, and it's parsed on every edit so it doesn't have to be parsed again at evaluation time, and what's stored is the parse tree with enough whitespace and comment hints to reconstruct the text for editing.

This is a case where looking at the textual code is rare, but hundreds of results must get updated in realtime on every change. This might be enough of a hint as to what program it is.

1

In Rust and lots of other languages you have to end each statement with a semicolon. The semi colon is usually placed right after the statement, but in this example there's indentation after each statement before the semicolon so they're all aligned.

There's also the curly brackets, they're padded in the same way, but those usually define where a scope (block) starts and ends making it even worse.

14

I dislike Python as well, but it has it place. I only use it for quick code tests before doing it in other languages.

1