Re: [css-houdini-drafts] [css-paint-api] Rename paint(name, args) to paint-name(args)

> This change does not increase the number of characters that need to be typed, whereas var-foo was more verbose.

This is a pretty minimal argument either way; we didn't really make the variables decision due to terseness.

> One issue with that variable syntax was the inconsistency between defining and referencing, whereas here paint-foo() is the only way this is referenced in the CSS.

No, the same inconsistency exists - `registerPaint("foo", ...)` would define a `paint-foo()` CSS function.  To avoid it we'd have to require that you put a `paint-` prefix on your painter name, like `registerPaint("paint-foo", ...)`.

> Defining a paint operation is a lot of work. Having a function to show for the latter is much more rewarding, whereas for variables there is no such psychological distinction: you are defining a new property either way.

I don't think psychological reward is a very important thing to optimize for.

> With variables, there was no issue of distinguishing what they do from their arguments, that came naturally anyway since the name was already separate from the value. So really, the equivalent opposite argument for variables would be to have something like --variable: foo actualValueOfFoo.

No, that's definition, which in this case *is* separated like that - `registerPaint("foo", ...)`. *Usage* is identical between variables and paint functions - `var(--foo)` vs `paint(foo)`.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/751#issuecomment-379753966 using your GitHub account

Received on Monday, 9 April 2018 13:35:40 UTC