Earlier quoted context omitted.
The entire OS was built around these source files. the unix philosophy on the other hand only "thrives" if every other tool is designed around (and contains code to parse) "plain text"
> The entire OS was built around these source files. And how did that work out for them? This seems like one of the many cases where unix won out by being a lowest common denominator. Every platform can handle plain text.
Formatting code should be unnecessary
181–190 of 484 posts
Re: Formatting code should be unnecessary
#182Some (sometimes) desirable source code formatting cannot be deduced from the abstract syntax tree alone: Consider the following (pseudo-)code example: bar.glob = 1; bar.plu.a1 = 21; bar.plu.coza = fol; Should this code formatted this way? Or should it be formatted bar.glob = 1; bar.plu.a1 = 21; bar.plu.coza = fol; to emphasize that three assignments are done? Or should this code be formatted bar.glob = 1; bar.plu .a1…
Re: Formatting code should be unnecessary
#183Earlier quoted context omitted.
Formatters eliminating long lines is a pet peeve of mine. About once every other project, some portion of the source benefits from source code being arranged in a tabular format. Long lines which are juxtaposed help make dissimilar values stand out. The following table is not unlike code I have written: setup_spi(&adc, mode=SPI_01, rate=15, cs_control=CS_MUXED, cs=0x01); setup_spi(&eeprom, mode=SPI_10, rate=13, cs_co…
Devs have different pixel count screens. Your table wrapped for me. The short line equivalent looks best on my screen. Thus 80 or perhaps 120 char line lengths!
Re: Formatting code should be unnecessary
#184I have to disagree with the premise. Formatting code is a critical communication channel. Well-formatted code should tell you: 1. The developer has enough experience to understand that formatting matters. 2. The developer has enough discipline to stick with their chosen formatting rules. 3. The developer has the taste necessary to choose good formatting rules. 4. The developer has the judgement necessary to identify…
There are times when you really want a specific formatting of the text, like visually turning a list into a table.
Re: Formatting code should be unnecessary
#185Re: Formatting code should be unnecessary
#186Some (sometimes) desirable source code formatting cannot be deduced from the abstract syntax tree alone: Consider the following (pseudo-)code example: bar.glob = 1; bar.plu.a1 = 21; bar.plu.coza = fol; Should this code formatted this way? Or should it be formatted bar.glob = 1; bar.plu.a1 = 21; bar.plu.coza = fol; to emphasize that three assignments are done? Or should this code be formatted bar.glob = 1; bar.plu .a1…
The second two lines of your example smell like LoD violations. It's not a formatting problem, it's a structural problem.
Re: Formatting code should be unnecessary
#187So I need to run a tool to even be able to read the code. No thank you, if anything goes wrong your file is now garbage.
In theory that's true of standard office document files too (.docx etc)? Don't think I've encountered too many issues of that actually happening though in the wild? I'm mainly just being pedantic to be honest, I realise my comment is just me essentially saying "what could possiblye go wrong?"
Re: Formatting code should be unnecessary
#188You can't easily search / grep etc. an IR, unless you use some kind of reverse translator. Readable source files have their benefits in being simple in that sense.
> unless you use some kind of reverse translator Would a few decades help in universally having such a translator in all the tools?
Re: Formatting code should be unnecessary
#189I've never understood why people care so much about the linter settings. It's so obviously bikeshedding, just make a choice, run the linter automatically and be done with it. I'm too busy doing actual software engineering to care about where exactly everything goes - I promise after a week you'll just get used to whatever format your team lands on.
Re: Formatting code should be unnecessary
#190Earlier quoted context omitted.
> unless you use some kind of reverse translator Would a few decades help in universally having such a translator in all the tools?
In all the tools? No, you'd need an infinite amount of time for that.