Re: [csswg-drafts] [css-nesting-1] Syntax Invites Errors (#7834)

There are, for sure, tradeoffs and issues with every option we've considered here. All of that is well documented in the proposal above. They all introduce potential footgunsfor authors, and they all come with caveats at the edges - issues that will impact some code styles more than others. 

From my perspective, the priority of this proposal was a _flexible and forgiving_ syntax. In the most common cases, it just works - and authors can migrate from existing code (both Sass and the PostCSS polyfill) easily. It's also possible to copy/paste that code to the root of the document, or into a scope rule, etc. The implications change slightly in those different cases, but in each one the code makes sense - and has the expected behavior.  

From there, authors can choose to make various improvements, based on their preferred code styles. This was also very clearly true of the existing syntax - where some authors may choose to require `@nest`, and others would choose not to. I agree, I likely wouldn't want to rely on 'the first `&` is special' behavior - so I would discuss with my team if we want to always use `&`, or always use `@nest`. Either way, we would set up a linter to enforce the style we want on our projects.

_Even though I wouldn't rely on it for large projects_, I still think it makes sense to allow that flexibility as far as possible, so that most things will just work. It's unfortunate that _as far as possible_ stops with the first `&`, but there are similar issues with the other proposals. 

We are not going to achieve a _perfect_ syntax here that everyone loves. But we can achieve one that has the flexibility to handle most of what authors throw at it. 

-- 
GitHub Notification of comment by mirisuzanne
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7834#issuecomment-1270352554 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 6 October 2022 16:17:16 UTC