Re: [csswg-drafts] [css-mixins] Should `result` be mandatory in `@function`? (#10562)

> you can have a function with a result that still doesn't get executed, by having it in a false MQ or something

It's still possible to require that a `result` must appear _directly_ beneath `@function` (perhaps in addition to results inside MQs, etc), causing _some_  `result` to always be encountered.

However, other languages has stuff like `std::optional`, Java `Optional`, etc, where returning nothing means the caller has to decide what to do. The same is possible in CSS if we return guaranteed-invalid for result-less functions:

```
--x: --maybe-no-result();
width: var(--x, 42px);
```

I think I prefer to leave results optional for this reason, even if it currently requires noisy indirection via a custom prop.

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


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

Received on Wednesday, 7 August 2024 11:49:20 UTC