Giter VIP home page Giter VIP logo

Comments (2)

DanielGavin avatar DanielGavin commented on July 21, 2024

The problem is the formatter is written much in the vein of javascripts prettier/rustfmt. There is no way of telling the formatter it should use one line it. It uses the width of lines to determine whether it should be broken.

You could technically ignore the core concept of the formatter by having some break character like the comma, but what happens in the reverse, the user wants to one line it, but the character width is above the threshold? One could say well it should just look at the comma, but then the whole width line breaking is completly removed.

In that case it would be better just to write a whole new formatter that acts less opinionated like gofmt. That is not necessarily a bad idea. This formatter could potentially be too agressive for some people. Even I sometimes wonder whether making a lighter gofmt styled formatter would be better.

from ols.

leidegre avatar leidegre commented on July 21, 2024

As a language designer, I think having an "official" opinionated style is a good thing because it helps with readability. It's good that all the code looks the same.

As a programmer, I rather be programming and not care about formatting. If the choice is taken away from me it's one less thing to care about.

I was thinking that a comma could be useful as a hint but I get that if it runs into with width limit and that then triggers other behavior then it's just more confusing.

I made a quick test in Go and it doesn't seem to care about the comma, I can break where I like. It will just indent stuff.

Which would enable layouts like this but why would you wanna do that? At least, to me it strikes me as odd because it is inconsistent. IMAO easy to misread?

swap_chain_desc := dxgi.SWAP_CHAIN_DESC1 {
	BufferCount = BACK_BUFFER_COUNT,
	Width = 0, Height = 0,
	Format = dxgi.FORMAT.R8G8B8A8_UNORM,
	Flags = {.FRAME_LATENCY_WAITABLE_OBJECT},
	BufferUsage = {.RENDER_TARGET_OUTPUT},
	SampleDesc = {
		Count = 1,
		Quality = 0,
	},
	SwapEffect = .FLIP_DISCARD, AlphaMode = .UNSPECIFIED, Scaling = .STRETCH, Stereo = false,
}

And what about alignment, is this better, worse or doesn't matter kind of deal?

swap_chain_desc := dxgi.SWAP_CHAIN_DESC1 {
	BufferCount = BACK_BUFFER_COUNT,
	Width       = 0, 
	Height      = 0,
	Format      = dxgi.FORMAT.R8G8B8A8_UNORM,
	Flags       = {.FRAME_LATENCY_WAITABLE_OBJECT},
	BufferUsage = {.RENDER_TARGET_OUTPUT},
	SampleDesc  = {
		Count   = 1,
		Quality = 0,
	},
	SwapEffect = .FLIP_DISCARD, 
	AlphaMode  = .UNSPECIFIED, 
	Scaling    = .STRETCH, 
	Stereo     = false,
}

SampleDesc kinda stands out in the above example.

Also, I might have misunderstood the relevance of the comma here. It is required for the code to be syntactically valid. I don't even think it's possible to use as I originally thought.

The more I think about it I don't know that it makes anything simpler. Bah, forget what I said.

from ols.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.