- From: Lea Verou via GitHub <noreply@w3.org>
- Date: Wed, 23 Jul 2025 21:04:09 +0000
- To: public-css-archive@w3.org
> > We can and do infer types in context. > > Yes, that's why I specifically said "in general" in the text you quoted. We do not always have appropriate context to be capable of resolving a value to a particular type. (At least, not without expensive/complicated backtracking that can, in the worst case, go exponential in cost, which is strictly unacceptable.) If we could have resolved the type of the first value, were it defined by itself, then we can resolve the type of the whole thing. This assumes we define its return type as a passthrough "the return type is the same as the type of its **first** argument". We don't have any functions typed this way in CSS today, but I don't see why it wouldn't work (but as always, I could be missing it). Note that it's the **first** argument, not any argument, which I think prevents your exponential backtracking / combinatorial explosion concern? Then you _never_ have to use `if()` for this, which also resolves your second point. -- GitHub Notification of comment by LeaVerou Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12513#issuecomment-3110167480 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 23 July 2025 21:04:10 UTC