Re: [csswg-drafts] [css-cascade] Should unnamed cascade layers be allowed? (#5792)

The CSS Working Group just discussed `Should we allow unnamed cascade layers?`, and agreed to the following:

* `RESOLVED: We will allow unnamed cascade layers`

<details><summary>The full IRC log of that discussion</summary>
&lt;myles> Topic: Should we allow unnamed cascade layers?<br>
&lt;astearns> github: https://github.com/w3c/csswg-drafts/issues/5792<br>
&lt;myles> astearns: Does this need discussion?<br>
&lt;myles> florian: yes.<br>
&lt;myles> TabAtkins: there are great argumetns for. I don't like the fact that you cannot reopen them. Having to name something you're only going to open once... you can never enter it agian, isn't great. Provides false sense of security from you being able to create an unnamed layer and ensure that nobody can mess with your stuff. It's not actually secure, it doesn't do anything secure.<br>
&lt;myles> TabAtkins: i don't like it much<br>
&lt;myles> jensimmo_: Can you make more than one unnamed layer that won't add to each other?<br>
&lt;myles> TabAtkins: it's as-if unnamed layers get a secret name.<br>
&lt;emilio> fantasai: For reference, the bespoke @import parsers: https://searchfox.org/mozilla-central/source/layout/style/ImportScanner.cpp / https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/html/parser/css_preload_scanner.cc;drc=2ac64302ae161cd6b5e4b1254497bdf5fd6d3415 / https://webkit-search.igalia.com/webkit/source/Source/WebCore/html/parser/CSSPreloadScanner.cpp<br>
&lt;myles> florian: I don't understad what you mean about security. If you're a framework and you want to organize your internals using layers, but it's not something you do to allow external users of your framework as ane xtension poitn to go inside your layers, having an ability to encapuslate a number of thigns is convenient<br>
&lt;myles> TabAtkins: Layers gives you everything you need. Unnamed layers just stops other people from breaking you by accident<br>
&lt;myles> TabAtkins: You cannot clash by accident.<br>
&lt;tantek> comboying++<br>
&lt;myles> jensimmo_: It feels like asking people to have names for everything biases the industry toward being organized and planning and doing "base" and "component" - hey, you don't have to have names, you just have a code, and the cascade is bugging you, just wrap it in @layer, i don't know why it works, just do it..... we might regret that, but it might be great. Maybe a person is the only person working on this code and they're just 'cowboy'ing it, mabye<br>
&lt;myles>  we don't want to encourage that.<br>
&lt;myles> florian: I'm all for the cowboy style.<br>
&lt;tantek> or rather, the "don't burden the author with more cognitive load" style<br>
&lt;fantasai> +1 tantek<br>
&lt;myles> florian: If you're not in the cowboy style and you're being dilligent, and you don't want your users to accidentally depend on your internals so you can't refactor yourself later, then this encapsulation to protect yourself from other people is valuable. Because they can't mess with your internals, they can't depend on your internals being a particular way<br>
&lt;fantasai> +1 florian<br>
&lt;myles> TabAtkins: This is CSS. Layers let you organize the cascade, but don't let you interact independently of anything. The styles after your code has to owrry about your code exactly as much of whether they're poking into you or not<br>
&lt;myles> fantasai: This stops them from depending on your specificity. THe sepcific order of rules does matter, but you no longer can have someone outside your stylesheet depending on how you've selected the elements. THey only depend on what properties finally at the end of the cascade of that lyaer end up attached to those elements.<br>
&lt;myles> fantasai: That does provide a meaningful level of encapuslation. So i agree with florian and jen. Don't put unnecessary congnitive load on the author (as tantek said)<br>
&lt;tantek> we all know naming things is hard. so don't make authors name things unnecessarily<br>
&lt;fantasai> tantek++<br>
&lt;myles> jensimmo_: I don't htink people will understand the encapuslation use case. It's a very advanced level of understanding of what's happening. But a better question to ask is: is a name required, if we decide not to do unnamed layers, what happesn if the name is left off. Are all styles inside the block invalid? does ever everything become valid in a secret name for the layer state? that will be common.<br>
&lt;myles> TabAtkins: It would be a syntax error. the whole block would be invalid<br>
&lt;myles> astearns: It's not great.<br>
&lt;myles> TabAtkins: It's just as not-great as screwing up your media query<br>
&lt;myles> TabAtkins: worry about syntax is not realistic because you can screw up any block.<br>
&lt;myles> TabAtkins: I'm okay with going without named layers, then<br>
&lt;myles> TabAtkins: I withdraw my objection.<br>
&lt;myles> RESOLVED: We will allow unnamed cascade layers<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5792#issuecomment-777871988 using your GitHub account


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

Received on Thursday, 11 February 2021 23:49:45 UTC