Re: [csswg-drafts] [css-mixins-1] Auto-wrap mixin body in `@result` if omitted? (#13524)

> I think in your example, the Mixin syntax used is the _least_ confusing aspect you need to understand. ^_^

That’s intentional — I wanted a case where the bulk of the complexity is _not_ in the mixin syntax.
Also, nobody made the claim that `@result` is confusing. The pushback is that it is repetitive boilerplate that reduces signal-to-noise ratio. If the vast majority of mixins used locals I could see the consistency argument, but I don't think that's the case.

I’m fine not using `@local` and auto-wrapping instead. I do think it should be possible to have multiple `@result` rules that are merged in that case so that authors don't have to separate computations from output. 

> Just in general, locals and custom props act a decent bit differently in a lot of cases, and if an author tries to use one as the other, there's a lot of potential for confusion or bugs. I believe that a small syntax difference like the suggested `@local` isn't enough to give a good mental separation, and people will be encouraged by bog-standard "shorter is easier" instincts to leave the prefix off and just get custom props, leading to subtle bugs.

If they're that different, I wonder if we need different syntax altogether, because even `@result {}` doesn't feel sufficient. 🤔 
If anything, it makes that distinction _less_ clear. Without documentation, nothing in the syntax indicates that variables outside of `@result` are local.

> I don't think it's very clear, neither from a learning perspective in general nor from a scanning perspective when reading the code, that --L1 and --L2 are legal, but --L3 and --L4 are illegal, while all of the --Pn properties are legal. The `@result` separation makes this easy - you define locals outside, you define custom props inside, every single usage is legal.

Whoa. I had not realized locals cannot be defined within nested rules. Why?
In that case, I agree that `@result {}` is clearer, but frankly, that's _extremely_ confusing in _both_ syntaxes. I'm not sure there is a syntax where having things that look identical to custom properties but behave differently is _not_ confusing… 🫤

This is yet another reason to (conceptually) auto-wrap: even if locals are not hard to implement (which makes sense, since you need them for parameters anyway), shipping a v1 without `@result` and without local definitions gives us more time to get locals right without this holding back the MVP. Even without locals, parameterized MVPs solve *a ton* of very pressing pain points. 

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


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

Received on Saturday, 7 March 2026 00:58:35 UTC